remove(list = ls())
library("foreign")
library("car")
library("haven")
library("psych")
library("Hmisc")
library("xtable")
setwd("/Users/dillonlaaker/Box Sync/Stability/data/datasets")
ines<-read.dta("ines_data.dta")
bes<-read.dta("bes_data.dta")
taps<-read.dta("taps_data.dta")
ncp<-read.dta("ncp_data.dta")
shp<-read.dta("shp_data.dta")
liss<-read.dta("liss_data.dta")
gles<-read.dta("gles_data.dta")
cces<-read.dta("cces_data.dta")
vsg<-read.dta("vsg_data.dta")


######################
######LISS PANEL######
######################

lisscor1a <- cor(liss$immigration_8[liss$all==0], liss$immigration_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$immigration_8[liss$all==0], liss$immigration_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$immigration_8[liss$all==0], liss$immigration_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$immigration_8[liss$all==0], liss$immigration_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$immigration_8[liss$all==0], liss$immigration_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$immigration_8[liss$all==0], liss$immigration_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$immigration_8[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$immigration_8[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$immigration_9[liss$all==0], liss$immigration_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$immigration_9[liss$all==0], liss$immigration_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$immigration_9[liss$all==0], liss$immigration_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$immigration_9[liss$all==0], liss$immigration_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$immigration_9[liss$all==0], liss$immigration_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$immigration_9[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$immigration_9[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$immigration_10[liss$all==0], liss$immigration_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$immigration_10[liss$all==0], liss$immigration_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$immigration_10[liss$all==0], liss$immigration_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$immigration_10[liss$all==0], liss$immigration_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$immigration_10[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$immigration_10[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$immigration_11[liss$all==0], liss$immigration_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$immigration_11[liss$all==0], liss$immigration_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$immigration_11[liss$all==0], liss$immigration_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$immigration_11[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$immigration_11[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$immigration_12[liss$all==0], liss$immigration_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$immigration_12[liss$all==0], liss$immigration_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$immigration_12[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$immigration_12[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$immigration_13[liss$all==0], liss$immigration_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$immigration_13[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$immigration_13[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$immigration_14[liss$all==0], liss$immigration_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$immigration_14[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$immigration_16[liss$all==0], liss$immigration_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$immigration_8[liss$all==1], liss$immigration_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$immigration_8[liss$all==1], liss$immigration_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$immigration_8[liss$all==1], liss$immigration_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$immigration_8[liss$all==1], liss$immigration_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$immigration_8[liss$all==1], liss$immigration_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$immigration_8[liss$all==1], liss$immigration_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$immigration_8[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$immigration_8[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$immigration_9[liss$all==1], liss$immigration_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$immigration_9[liss$all==1], liss$immigration_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$immigration_9[liss$all==1], liss$immigration_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$immigration_9[liss$all==1], liss$immigration_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$immigration_9[liss$all==1], liss$immigration_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$immigration_9[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$immigration_9[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$immigration_10[liss$all==1], liss$immigration_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$immigration_10[liss$all==1], liss$immigration_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$immigration_10[liss$all==1], liss$immigration_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$immigration_10[liss$all==1], liss$immigration_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$immigration_10[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$immigration_10[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$immigration_11[liss$all==1], liss$immigration_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$immigration_11[liss$all==1], liss$immigration_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$immigration_11[liss$all==1], liss$immigration_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$immigration_11[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$immigration_11[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$immigration_12[liss$all==1], liss$immigration_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$immigration_12[liss$all==1], liss$immigration_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$immigration_12[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$immigration_12[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$immigration_13[liss$all==1], liss$immigration_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$immigration_13[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$immigration_13[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$immigration_14[liss$all==1], liss$immigration_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$immigration_14[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$immigration_16[liss$all==1], liss$immigration_17[liss$all==1], method="spearman", use="pairwise")

lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa <- sum(lisscordiff1)/36
lisscordiffb <- sum(lisscordiff2)/36
lisscor_max <- max(lisscordiff1)

lisscora <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor <- cbind(lisscora, lisscorb)

##Question 1

lisscor1a <- cor(liss$imm1_8[liss$all==0], liss$imm1_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$imm1_8[liss$all==0], liss$imm1_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$imm1_8[liss$all==0], liss$imm1_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$imm1_8[liss$all==0], liss$imm1_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$imm1_8[liss$all==0], liss$imm1_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$imm1_8[liss$all==0], liss$imm1_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$imm1_8[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$imm1_8[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$imm1_9[liss$all==0], liss$imm1_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$imm1_9[liss$all==0], liss$imm1_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$imm1_9[liss$all==0], liss$imm1_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$imm1_9[liss$all==0], liss$imm1_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$imm1_9[liss$all==0], liss$imm1_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$imm1_9[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$imm1_9[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$imm1_10[liss$all==0], liss$imm1_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$imm1_10[liss$all==0], liss$imm1_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$imm1_10[liss$all==0], liss$imm1_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$imm1_10[liss$all==0], liss$imm1_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$imm1_10[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$imm1_10[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$imm1_11[liss$all==0], liss$imm1_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$imm1_11[liss$all==0], liss$imm1_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$imm1_11[liss$all==0], liss$imm1_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$imm1_11[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$imm1_11[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$imm1_12[liss$all==0], liss$imm1_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$imm1_12[liss$all==0], liss$imm1_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$imm1_12[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$imm1_12[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$imm1_13[liss$all==0], liss$imm1_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$imm1_13[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$imm1_13[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$imm1_14[liss$all==0], liss$imm1_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$imm1_14[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$imm1_16[liss$all==0], liss$imm1_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$imm1_8[liss$all==1], liss$imm1_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$imm1_8[liss$all==1], liss$imm1_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$imm1_8[liss$all==1], liss$imm1_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$imm1_8[liss$all==1], liss$imm1_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$imm1_8[liss$all==1], liss$imm1_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$imm1_8[liss$all==1], liss$imm1_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$imm1_8[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$imm1_8[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$imm1_9[liss$all==1], liss$imm1_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$imm1_9[liss$all==1], liss$imm1_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$imm1_9[liss$all==1], liss$imm1_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$imm1_9[liss$all==1], liss$imm1_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$imm1_9[liss$all==1], liss$imm1_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$imm1_9[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$imm1_9[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$imm1_10[liss$all==1], liss$imm1_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$imm1_10[liss$all==1], liss$imm1_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$imm1_10[liss$all==1], liss$imm1_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$imm1_10[liss$all==1], liss$imm1_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$imm1_10[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$imm1_10[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$imm1_11[liss$all==1], liss$imm1_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$imm1_11[liss$all==1], liss$imm1_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$imm1_11[liss$all==1], liss$imm1_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$imm1_11[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$imm1_11[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$imm1_12[liss$all==1], liss$imm1_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$imm1_12[liss$all==1], liss$imm1_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$imm1_12[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$imm1_12[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$imm1_13[liss$all==1], liss$imm1_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$imm1_13[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$imm1_13[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$imm1_14[liss$all==1], liss$imm1_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$imm1_14[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$imm1_16[liss$all==1], liss$imm1_17[liss$all==1], method="spearman", use="pairwise")

lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa1 <- sum(lisscordiff1)/36
lisscordiffb1 <- sum(lisscordiff2)/36
lisscor_max1 <- max(lisscordiff1)

lisscora1 <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb1 <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor1 <- cbind(lisscora, lisscorb)

##Question 2

lisscor1a <- cor(liss$imm2_8[liss$all==0], liss$imm2_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$imm2_8[liss$all==0], liss$imm2_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$imm2_8[liss$all==0], liss$imm2_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$imm2_8[liss$all==0], liss$imm2_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$imm2_8[liss$all==0], liss$imm2_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$imm2_8[liss$all==0], liss$imm2_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$imm2_8[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$imm2_8[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$imm2_9[liss$all==0], liss$imm2_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$imm2_9[liss$all==0], liss$imm2_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$imm2_9[liss$all==0], liss$imm2_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$imm2_9[liss$all==0], liss$imm2_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$imm2_9[liss$all==0], liss$imm2_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$imm2_9[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$imm2_9[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$imm2_10[liss$all==0], liss$imm2_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$imm2_10[liss$all==0], liss$imm2_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$imm2_10[liss$all==0], liss$imm2_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$imm2_10[liss$all==0], liss$imm2_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$imm2_10[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$imm2_10[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$imm2_11[liss$all==0], liss$imm2_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$imm2_11[liss$all==0], liss$imm2_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$imm2_11[liss$all==0], liss$imm2_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$imm2_11[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$imm2_11[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$imm2_12[liss$all==0], liss$imm2_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$imm2_12[liss$all==0], liss$imm2_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$imm2_12[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$imm2_12[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$imm2_13[liss$all==0], liss$imm2_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$imm2_13[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$imm2_13[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$imm2_14[liss$all==0], liss$imm2_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$imm2_14[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$imm2_16[liss$all==0], liss$imm2_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$imm2_8[liss$all==1], liss$imm2_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$imm2_8[liss$all==1], liss$imm2_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$imm2_8[liss$all==1], liss$imm2_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$imm2_8[liss$all==1], liss$imm2_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$imm2_8[liss$all==1], liss$imm2_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$imm2_8[liss$all==1], liss$imm2_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$imm2_8[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$imm2_8[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$imm2_9[liss$all==1], liss$imm2_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$imm2_9[liss$all==1], liss$imm2_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$imm2_9[liss$all==1], liss$imm2_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$imm2_9[liss$all==1], liss$imm2_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$imm2_9[liss$all==1], liss$imm2_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$imm2_9[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$imm2_9[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$imm2_10[liss$all==1], liss$imm2_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$imm2_10[liss$all==1], liss$imm2_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$imm2_10[liss$all==1], liss$imm2_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$imm2_10[liss$all==1], liss$imm2_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$imm2_10[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$imm2_10[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$imm2_11[liss$all==1], liss$imm2_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$imm2_11[liss$all==1], liss$imm2_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$imm2_11[liss$all==1], liss$imm2_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$imm2_11[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$imm2_11[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$imm2_12[liss$all==1], liss$imm2_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$imm2_12[liss$all==1], liss$imm2_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$imm2_12[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$imm2_12[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$imm2_13[liss$all==1], liss$imm2_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$imm2_13[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$imm2_13[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$imm2_14[liss$all==1], liss$imm2_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$imm2_14[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$imm2_16[liss$all==1], liss$imm2_17[liss$all==1], method="spearman", use="pairwise")


lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa2 <- sum(lisscordiff1)/36
lisscordiffb2 <- sum(lisscordiff2)/36
lisscor_max2 <- max(lisscordiff1)

lisscora2 <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb2 <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor2 <- cbind(lisscora, lisscorb)

##Question 3
lisscor1a <- cor(liss$imm3_8[liss$all==0], liss$imm3_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$imm3_8[liss$all==0], liss$imm3_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$imm3_8[liss$all==0], liss$imm3_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$imm3_8[liss$all==0], liss$imm3_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$imm3_8[liss$all==0], liss$imm3_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$imm3_8[liss$all==0], liss$imm3_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$imm3_8[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$imm3_8[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$imm3_9[liss$all==0], liss$imm3_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$imm3_9[liss$all==0], liss$imm3_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$imm3_9[liss$all==0], liss$imm3_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$imm3_9[liss$all==0], liss$imm3_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$imm3_9[liss$all==0], liss$imm3_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$imm3_9[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$imm3_9[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$imm3_10[liss$all==0], liss$imm3_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$imm3_10[liss$all==0], liss$imm3_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$imm3_10[liss$all==0], liss$imm3_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$imm3_10[liss$all==0], liss$imm3_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$imm3_10[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$imm3_10[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$imm3_11[liss$all==0], liss$imm3_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$imm3_11[liss$all==0], liss$imm3_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$imm3_11[liss$all==0], liss$imm3_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$imm3_11[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$imm3_11[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$imm3_12[liss$all==0], liss$imm3_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$imm3_12[liss$all==0], liss$imm3_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$imm3_12[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$imm3_12[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$imm3_13[liss$all==0], liss$imm3_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$imm3_13[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$imm3_13[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$imm3_14[liss$all==0], liss$imm3_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$imm3_14[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$imm3_16[liss$all==0], liss$imm3_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$imm3_8[liss$all==1], liss$imm3_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$imm3_8[liss$all==1], liss$imm3_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$imm3_8[liss$all==1], liss$imm3_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$imm3_8[liss$all==1], liss$imm3_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$imm3_8[liss$all==1], liss$imm3_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$imm3_8[liss$all==1], liss$imm3_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$imm3_8[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$imm3_8[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$imm3_9[liss$all==1], liss$imm3_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$imm3_9[liss$all==1], liss$imm3_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$imm3_9[liss$all==1], liss$imm3_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$imm3_9[liss$all==1], liss$imm3_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$imm3_9[liss$all==1], liss$imm3_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$imm3_9[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$imm3_9[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$imm3_10[liss$all==1], liss$imm3_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$imm3_10[liss$all==1], liss$imm3_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$imm3_10[liss$all==1], liss$imm3_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$imm3_10[liss$all==1], liss$imm3_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$imm3_10[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$imm3_10[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$imm3_11[liss$all==1], liss$imm3_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$imm3_11[liss$all==1], liss$imm3_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$imm3_11[liss$all==1], liss$imm3_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$imm3_11[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$imm3_11[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$imm3_12[liss$all==1], liss$imm3_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$imm3_12[liss$all==1], liss$imm3_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$imm3_12[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$imm3_12[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$imm3_13[liss$all==1], liss$imm3_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$imm3_13[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$imm3_13[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$imm3_14[liss$all==1], liss$imm3_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$imm3_14[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$imm3_16[liss$all==1], liss$imm3_17[liss$all==1], method="spearman", use="pairwise")


lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa3 <- sum(lisscordiff1)/36
lisscordiffb3 <- sum(lisscordiff2)/36
lisscor_max3 <- max(lisscordiff1)

lisscora3 <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb3 <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor3 <- cbind(lisscora, lisscorb)

##Question 4

lisscor1a <- cor(liss$imm4_8[liss$all==0], liss$imm4_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$imm4_8[liss$all==0], liss$imm4_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$imm4_8[liss$all==0], liss$imm4_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$imm4_8[liss$all==0], liss$imm4_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$imm4_8[liss$all==0], liss$imm4_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$imm4_8[liss$all==0], liss$imm4_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$imm4_8[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$imm4_8[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$imm4_9[liss$all==0], liss$imm4_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$imm4_9[liss$all==0], liss$imm4_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$imm4_9[liss$all==0], liss$imm4_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$imm4_9[liss$all==0], liss$imm4_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$imm4_9[liss$all==0], liss$imm4_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$imm4_9[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$imm4_9[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$imm4_10[liss$all==0], liss$imm4_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$imm4_10[liss$all==0], liss$imm4_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$imm4_10[liss$all==0], liss$imm4_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$imm4_10[liss$all==0], liss$imm4_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$imm4_10[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$imm4_10[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$imm4_11[liss$all==0], liss$imm4_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$imm4_11[liss$all==0], liss$imm4_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$imm4_11[liss$all==0], liss$imm4_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$imm4_11[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$imm4_11[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$imm4_12[liss$all==0], liss$imm4_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$imm4_12[liss$all==0], liss$imm4_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$imm4_12[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$imm4_12[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$imm4_13[liss$all==0], liss$imm4_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$imm4_13[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$imm4_13[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$imm4_14[liss$all==0], liss$imm4_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$imm4_14[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$imm4_16[liss$all==0], liss$imm4_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$imm4_8[liss$all==1], liss$imm4_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$imm4_8[liss$all==1], liss$imm4_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$imm4_8[liss$all==1], liss$imm4_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$imm4_8[liss$all==1], liss$imm4_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$imm4_8[liss$all==1], liss$imm4_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$imm4_8[liss$all==1], liss$imm4_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$imm4_8[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$imm4_8[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$imm4_9[liss$all==1], liss$imm4_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$imm4_9[liss$all==1], liss$imm4_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$imm4_9[liss$all==1], liss$imm4_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$imm4_9[liss$all==1], liss$imm4_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$imm4_9[liss$all==1], liss$imm4_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$imm4_9[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$imm4_9[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$imm4_10[liss$all==1], liss$imm4_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$imm4_10[liss$all==1], liss$imm4_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$imm4_10[liss$all==1], liss$imm4_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$imm4_10[liss$all==1], liss$imm4_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$imm4_10[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$imm4_10[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$imm4_11[liss$all==1], liss$imm4_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$imm4_11[liss$all==1], liss$imm4_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$imm4_11[liss$all==1], liss$imm4_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$imm4_11[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$imm4_11[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$imm4_12[liss$all==1], liss$imm4_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$imm4_12[liss$all==1], liss$imm4_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$imm4_12[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$imm4_12[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$imm4_13[liss$all==1], liss$imm4_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$imm4_13[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$imm4_13[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$imm4_14[liss$all==1], liss$imm4_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$imm4_14[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$imm4_16[liss$all==1], liss$imm4_17[liss$all==1], method="spearman", use="pairwise")


lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa4 <- sum(lisscordiff1)/36
lisscordiffb4 <- sum(lisscordiff2)/36
lisscor_max4 <- max(lisscordiff1)

lisscora4 <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb4 <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor4 <- cbind(lisscora, lisscorb)

##Question 5

lisscor1a <- cor(liss$imm5_8[liss$all==0], liss$imm5_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$imm5_8[liss$all==0], liss$imm5_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$imm5_8[liss$all==0], liss$imm5_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$imm5_8[liss$all==0], liss$imm5_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$imm5_8[liss$all==0], liss$imm5_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$imm5_8[liss$all==0], liss$imm5_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$imm5_8[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$imm5_8[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$imm5_9[liss$all==0], liss$imm5_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$imm5_9[liss$all==0], liss$imm5_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$imm5_9[liss$all==0], liss$imm5_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$imm5_9[liss$all==0], liss$imm5_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$imm5_9[liss$all==0], liss$imm5_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$imm5_9[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$imm5_9[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$imm5_10[liss$all==0], liss$imm5_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$imm5_10[liss$all==0], liss$imm5_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$imm5_10[liss$all==0], liss$imm5_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$imm5_10[liss$all==0], liss$imm5_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$imm5_10[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$imm5_10[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$imm5_11[liss$all==0], liss$imm5_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$imm5_11[liss$all==0], liss$imm5_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$imm5_11[liss$all==0], liss$imm5_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$imm5_11[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$imm5_11[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$imm5_12[liss$all==0], liss$imm5_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$imm5_12[liss$all==0], liss$imm5_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$imm5_12[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$imm5_12[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$imm5_13[liss$all==0], liss$imm5_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$imm5_13[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$imm5_13[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$imm5_14[liss$all==0], liss$imm5_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$imm5_14[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$imm5_16[liss$all==0], liss$imm5_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$imm5_8[liss$all==1], liss$imm5_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$imm5_8[liss$all==1], liss$imm5_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$imm5_8[liss$all==1], liss$imm5_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$imm5_8[liss$all==1], liss$imm5_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$imm5_8[liss$all==1], liss$imm5_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$imm5_8[liss$all==1], liss$imm5_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$imm5_8[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$imm5_8[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$imm5_9[liss$all==1], liss$imm5_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$imm5_9[liss$all==1], liss$imm5_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$imm5_9[liss$all==1], liss$imm5_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$imm5_9[liss$all==1], liss$imm5_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$imm5_9[liss$all==1], liss$imm5_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$imm5_9[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$imm5_9[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$imm5_10[liss$all==1], liss$imm5_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$imm5_10[liss$all==1], liss$imm5_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$imm5_10[liss$all==1], liss$imm5_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$imm5_10[liss$all==1], liss$imm5_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$imm5_10[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$imm5_10[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$imm5_11[liss$all==1], liss$imm5_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$imm5_11[liss$all==1], liss$imm5_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$imm5_11[liss$all==1], liss$imm5_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$imm5_11[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$imm5_11[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$imm5_12[liss$all==1], liss$imm5_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$imm5_12[liss$all==1], liss$imm5_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$imm5_12[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$imm5_12[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$imm5_13[liss$all==1], liss$imm5_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$imm5_13[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$imm5_13[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$imm5_14[liss$all==1], liss$imm5_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$imm5_14[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$imm5_16[liss$all==1], liss$imm5_17[liss$all==1], method="spearman", use="pairwise")


lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa5 <- sum(lisscordiff1)/36
lisscordiffb5 <- sum(lisscordiff2)/36
lisscor_max5 <- max(lisscordiff1)

lisscora5 <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb5 <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor5 <- cbind(lisscora, lisscorb)

##Question 6

lisscor1a <- cor(liss$imm6_8[liss$all==0], liss$imm6_9[liss$all==0], method="spearman", use="pairwise")
lisscor2a <- cor(liss$imm6_8[liss$all==0], liss$imm6_10[liss$all==0], method="spearman", use="pairwise")
lisscor3a <- cor(liss$imm6_8[liss$all==0], liss$imm6_11[liss$all==0], method="spearman", use="pairwise")
lisscor4a <- cor(liss$imm6_8[liss$all==0], liss$imm6_12[liss$all==0], method="spearman", use="pairwise")
lisscor5a <- cor(liss$imm6_8[liss$all==0], liss$imm6_13[liss$all==0], method="spearman", use="pairwise")
lisscor6a <- cor(liss$imm6_8[liss$all==0], liss$imm6_14[liss$all==0], method="spearman", use="pairwise")
lisscor7a <- cor(liss$imm6_8[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor8a <- cor(liss$imm6_8[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor9a <- cor(liss$imm6_9[liss$all==0], liss$imm6_10[liss$all==0], method="spearman", use="pairwise")
lisscor10a <- cor(liss$imm6_9[liss$all==0], liss$imm6_11[liss$all==0], method="spearman", use="pairwise")
lisscor11a <- cor(liss$imm6_9[liss$all==0], liss$imm6_12[liss$all==0], method="spearman", use="pairwise")
lisscor12a <- cor(liss$imm6_9[liss$all==0], liss$imm6_13[liss$all==0], method="spearman", use="pairwise")
lisscor13a <- cor(liss$imm6_9[liss$all==0], liss$imm6_14[liss$all==0], method="spearman", use="pairwise")
lisscor14a <- cor(liss$imm6_9[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor15a <- cor(liss$imm6_9[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor16a <- cor(liss$imm6_10[liss$all==0], liss$imm6_11[liss$all==0], method="spearman", use="pairwise")
lisscor17a <- cor(liss$imm6_10[liss$all==0], liss$imm6_12[liss$all==0], method="spearman", use="pairwise")
lisscor18a <- cor(liss$imm6_10[liss$all==0], liss$imm6_13[liss$all==0], method="spearman", use="pairwise")
lisscor19a <- cor(liss$imm6_10[liss$all==0], liss$imm6_14[liss$all==0], method="spearman", use="pairwise")
lisscor20a <- cor(liss$imm6_10[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor21a <- cor(liss$imm6_10[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor22a <- cor(liss$imm6_11[liss$all==0], liss$imm6_12[liss$all==0], method="spearman", use="pairwise")
lisscor23a <- cor(liss$imm6_11[liss$all==0], liss$imm6_13[liss$all==0], method="spearman", use="pairwise")
lisscor24a <- cor(liss$imm6_11[liss$all==0], liss$imm6_14[liss$all==0], method="spearman", use="pairwise")
lisscor25a <- cor(liss$imm6_11[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor26a <- cor(liss$imm6_11[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor27a <- cor(liss$imm6_12[liss$all==0], liss$imm6_13[liss$all==0], method="spearman", use="pairwise")
lisscor28a <- cor(liss$imm6_12[liss$all==0], liss$imm6_14[liss$all==0], method="spearman", use="pairwise")
lisscor29a <- cor(liss$imm6_12[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor30a <- cor(liss$imm6_12[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor31a <- cor(liss$imm6_13[liss$all==0], liss$imm6_14[liss$all==0], method="spearman", use="pairwise")
lisscor32a <- cor(liss$imm6_13[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor33a <- cor(liss$imm6_13[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor34a <- cor(liss$imm6_14[liss$all==0], liss$imm6_16[liss$all==0], method="spearman", use="pairwise")
lisscor35a <- cor(liss$imm6_14[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")
lisscor36a <- cor(liss$imm6_16[liss$all==0], liss$imm6_17[liss$all==0], method="spearman", use="pairwise")

lisscor1b <- cor(liss$imm6_8[liss$all==1], liss$imm6_9[liss$all==1], method="spearman", use="pairwise")
lisscor2b <- cor(liss$imm6_8[liss$all==1], liss$imm6_10[liss$all==1], method="spearman", use="pairwise")
lisscor3b <- cor(liss$imm6_8[liss$all==1], liss$imm6_11[liss$all==1], method="spearman", use="pairwise")
lisscor4b <- cor(liss$imm6_8[liss$all==1], liss$imm6_12[liss$all==1], method="spearman", use="pairwise")
lisscor5b <- cor(liss$imm6_8[liss$all==1], liss$imm6_13[liss$all==1], method="spearman", use="pairwise")
lisscor6b <- cor(liss$imm6_8[liss$all==1], liss$imm6_14[liss$all==1], method="spearman", use="pairwise")
lisscor7b <- cor(liss$imm6_8[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor8b <- cor(liss$imm6_8[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor9b <- cor(liss$imm6_9[liss$all==1], liss$imm6_10[liss$all==1], method="spearman", use="pairwise")
lisscor10b <- cor(liss$imm6_9[liss$all==1], liss$imm6_11[liss$all==1], method="spearman", use="pairwise")
lisscor11b <- cor(liss$imm6_9[liss$all==1], liss$imm6_12[liss$all==1], method="spearman", use="pairwise")
lisscor12b <- cor(liss$imm6_9[liss$all==1], liss$imm6_13[liss$all==1], method="spearman", use="pairwise")
lisscor13b <- cor(liss$imm6_9[liss$all==1], liss$imm6_14[liss$all==1], method="spearman", use="pairwise")
lisscor14b <- cor(liss$imm6_9[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor15b <- cor(liss$imm6_9[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor16b <- cor(liss$imm6_10[liss$all==1], liss$imm6_11[liss$all==1], method="spearman", use="pairwise")
lisscor17b <- cor(liss$imm6_10[liss$all==1], liss$imm6_12[liss$all==1], method="spearman", use="pairwise")
lisscor18b <- cor(liss$imm6_10[liss$all==1], liss$imm6_13[liss$all==1], method="spearman", use="pairwise")
lisscor19b <- cor(liss$imm6_10[liss$all==1], liss$imm6_14[liss$all==1], method="spearman", use="pairwise")
lisscor20b <- cor(liss$imm6_10[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor21b <- cor(liss$imm6_10[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor22b <- cor(liss$imm6_11[liss$all==1], liss$imm6_12[liss$all==1], method="spearman", use="pairwise")
lisscor23b <- cor(liss$imm6_11[liss$all==1], liss$imm6_13[liss$all==1], method="spearman", use="pairwise")
lisscor24b <- cor(liss$imm6_11[liss$all==1], liss$imm6_14[liss$all==1], method="spearman", use="pairwise")
lisscor25b <- cor(liss$imm6_11[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor26b <- cor(liss$imm6_11[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor27b <- cor(liss$imm6_12[liss$all==1], liss$imm6_13[liss$all==1], method="spearman", use="pairwise")
lisscor28b <- cor(liss$imm6_12[liss$all==1], liss$imm6_14[liss$all==1], method="spearman", use="pairwise")
lisscor29b <- cor(liss$imm6_12[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor30b <- cor(liss$imm6_12[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor31b <- cor(liss$imm6_13[liss$all==1], liss$imm6_14[liss$all==1], method="spearman", use="pairwise")
lisscor32b <- cor(liss$imm6_13[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor33b <- cor(liss$imm6_13[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor34b <- cor(liss$imm6_14[liss$all==1], liss$imm6_16[liss$all==1], method="spearman", use="pairwise")
lisscor35b <- cor(liss$imm6_14[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")
lisscor36b <- cor(liss$imm6_16[liss$all==1], liss$imm6_17[liss$all==1], method="spearman", use="pairwise")

lisscor1diffa <- abs(lisscor1a - lisscor1b)
lisscor2diffa <- abs(lisscor2a - lisscor2b)
lisscor3diffa <- abs(lisscor3a - lisscor3b)
lisscor4diffa <- abs(lisscor4a - lisscor4b)
lisscor5diffa <- abs(lisscor5a - lisscor5b)
lisscor6diffa <- abs(lisscor6a - lisscor6b)
lisscor7diffa <- abs(lisscor7a - lisscor7b)
lisscor8diffa <- abs(lisscor8a - lisscor8b)
lisscor9diffa <- abs(lisscor9a - lisscor9b)
lisscor10diffa <- abs(lisscor10a - lisscor10b)
lisscor11diffa <- abs(lisscor11a - lisscor11b)
lisscor12diffa <- abs(lisscor12a - lisscor12b)
lisscor13diffa <- abs(lisscor13a - lisscor13b)
lisscor14diffa <- abs(lisscor14a - lisscor14b)
lisscor15diffa <- abs(lisscor15a - lisscor15b)
lisscor16diffa <- abs(lisscor16a - lisscor16b)
lisscor17diffa <- abs(lisscor17a - lisscor17b)
lisscor18diffa <- abs(lisscor18a - lisscor18b)
lisscor19diffa <- abs(lisscor19a - lisscor19b)
lisscor20diffa <- abs(lisscor20a - lisscor20b)
lisscor21diffa <- abs(lisscor21a - lisscor21b)
lisscor22diffa <- abs(lisscor22a - lisscor22b)
lisscor23diffa <- abs(lisscor23a - lisscor23b)
lisscor24diffa <- abs(lisscor24a - lisscor24b)
lisscor25diffa <- abs(lisscor25a - lisscor25b)
lisscor26diffa <- abs(lisscor26a - lisscor26b)
lisscor27diffa <- abs(lisscor27a - lisscor27b)
lisscor28diffa <- abs(lisscor28a - lisscor28b)
lisscor29diffa <- abs(lisscor29a - lisscor29b)
lisscor30diffa <- abs(lisscor30a - lisscor30b)
lisscor31diffa <- abs(lisscor31a - lisscor31b)
lisscor32diffa <- abs(lisscor32a - lisscor32b)
lisscor33diffa <- abs(lisscor33a - lisscor33b)
lisscor34diffa <- abs(lisscor34a - lisscor34b)
lisscor35diffa <- abs(lisscor35a - lisscor35b)
lisscor36diffa <- abs(lisscor36a - lisscor36b)

lisscor1diffb <- lisscor1a - lisscor1b
lisscor2diffb <- lisscor2a - lisscor2b
lisscor3diffb <- lisscor3a - lisscor3b
lisscor4diffb <- lisscor4a - lisscor4b
lisscor5diffb <- lisscor5a - lisscor5b
lisscor6diffb <- lisscor6a - lisscor6b
lisscor7diffb <- lisscor7a - lisscor7b
lisscor8diffb <- lisscor8a - lisscor8b
lisscor9diffb <- lisscor9a - lisscor9b
lisscor10diffb <- lisscor10a - lisscor10b
lisscor11diffb <- lisscor11a - lisscor11b
lisscor12diffb <- lisscor12a - lisscor12b
lisscor13diffb <- lisscor13a - lisscor13b
lisscor14diffb <- lisscor14a - lisscor14b
lisscor15diffb <- lisscor15a - lisscor15b
lisscor16diffb <- lisscor16a - lisscor16b
lisscor17diffb <- lisscor17a - lisscor17b
lisscor18diffb <- lisscor18a - lisscor18b
lisscor19diffb <- lisscor19a - lisscor19b
lisscor20diffb <- lisscor20a - lisscor20b
lisscor21diffb <- lisscor21a - lisscor21b
lisscor22diffb <- lisscor22a - lisscor22b
lisscor23diffb <- lisscor23a - lisscor23b
lisscor24diffb <- lisscor24a - lisscor24b
lisscor25diffb <- lisscor25a - lisscor25b
lisscor26diffb <- lisscor26a - lisscor26b
lisscor27diffb <- lisscor27a - lisscor27b
lisscor28diffb <- lisscor28a - lisscor28b
lisscor29diffb <- lisscor29a - lisscor29b
lisscor30diffb <- lisscor30a - lisscor30b
lisscor31diffb <- lisscor31a - lisscor31b
lisscor32diffb <- lisscor32a - lisscor32b
lisscor33diffb <- lisscor33a - lisscor33b
lisscor34diffb <- lisscor34a - lisscor34b
lisscor35diffb <- lisscor35a - lisscor35b
lisscor36diffb <- lisscor36a - lisscor36b

lisscordiff1 <- c(lisscor1diffa, lisscor2diffa, lisscor3diffa, lisscor4diffa, lisscor5diffa, lisscor6diffa, lisscor7diffa, lisscor8diffa, lisscor9diffa, lisscor10diffa, lisscor11diffa, lisscor12diffa, lisscor13diffa, lisscor14diffa, lisscor15diffa, lisscor16diffa, lisscor17diffa, lisscor18diffa, lisscor19diffa, lisscor20diffa, lisscor21diffa, lisscor22diffa, lisscor23diffa, lisscor24diffa, lisscor25diffa, lisscor26diffa, lisscor27diffa, lisscor28diffa, lisscor29diffa, lisscor30diffa, lisscor31diffa, lisscor32diffa, lisscor33diffa, lisscor34diffa, lisscor35diffa, lisscor36diffa)
lisscordiff2 <- c(lisscor1diffb, lisscor2diffb, lisscor3diffb, lisscor4diffb, lisscor5diffb, lisscor6diffb, lisscor7diffb, lisscor8diffb, lisscor9diffb, lisscor10diffb, lisscor11diffb, lisscor12diffb, lisscor13diffb, lisscor14diffb, lisscor15diffb, lisscor16diffb, lisscor17diffb, lisscor18diffb, lisscor19diffb, lisscor20diffb, lisscor21diffb, lisscor22diffb, lisscor23diffb, lisscor24diffb, lisscor25diffb, lisscor26diffb, lisscor27diffb, lisscor28diffb, lisscor29diffb, lisscor30diffb, lisscor31diffb, lisscor32diffb, lisscor33diffb, lisscor34diffb, lisscor35diffb, lisscor36diffb)
lisscordiffa6 <- sum(lisscordiff1)/36
lisscordiffb6 <- sum(lisscordiff2)/36
lisscor_max6 <- max(lisscordiff1)

lisscora6 <- c(lisscor1a, lisscor2a, lisscor3a, lisscor4a, lisscor5a, lisscor6a, lisscor7a, lisscor8a, lisscor9a, lisscor10a, lisscor11a, lisscor12a, lisscor13a, lisscor14a, lisscor15a, lisscor16a, lisscor17a, lisscor18a, lisscor19a, lisscor20a, lisscor21a, lisscor22a, lisscor23a, lisscor24a, lisscor25a, lisscor26a, lisscor27a, lisscor28a, lisscor29a, lisscor30a, lisscor31a, lisscor32a, lisscor33a, lisscor34a, lisscor35a, lisscor36a)

lisscorb6 <- c(lisscor1b, lisscor2b, lisscor3b, lisscor4b, lisscor5b, lisscor6b, lisscor7b, lisscor8b, lisscor9b, lisscor10b, lisscor11b, lisscor12b, lisscor13b, lisscor14b, lisscor15b, lisscor16b, lisscor17b, lisscor18b, lisscor19b, lisscor20b, lisscor21b, lisscor22b, lisscor23b, lisscor24b, lisscor25b, lisscor26b, lisscor27b, lisscor28b, lisscor29b, lisscor30b, lisscor31b, lisscor32b, lisscor33b, lisscor34b, lisscor35b, lisscor36a)

lisscor6 <- cbind(lisscora, lisscorb)

lisscoria <- (lisscordiffa1 + lisscordiffa2 + lisscordiffa3 + lisscordiffa4 + lisscordiffa5 + lisscordiffa6)/6
lisscorib <- (lisscordiffb1 + lisscordiffb2 + lisscordiffb3 + lisscordiffb4 + lisscordiffb5 + lisscordiffb6)/6

lisscor_max <- c(lisscor_max1, lisscor_max2, lisscor_max3, lisscor_max4, lisscor_max5, lisscor_max6)
lisscor_max <- max(lisscor_max)

#######################
###### BES PANEL ######
#######################

## Economy

bescor1a <- cor(bes$immecon1[bes$all==0], bes$immecon2[bes$all==0], method="spearman", use="pairwise")
bescor2a <- cor(bes$immecon1[bes$all==0], bes$immecon3[bes$all==0], method="spearman", use="pairwise")
bescor3a <- cor(bes$immecon1[bes$all==0], bes$immecon4[bes$all==0], method="spearman", use="pairwise")
bescor4a <- cor(bes$immecon1[bes$all==0], bes$immecon7[bes$all==0], method="spearman", use="pairwise")
bescor5a <- cor(bes$immecon1[bes$all==0], bes$immecon8[bes$all==0], method="spearman", use="pairwise")
bescor6a <- cor(bes$immecon1[bes$all==0], bes$immecon10[bes$all==0], method="spearman", use="pairwise")
bescor7a <- cor(bes$immecon1[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")
bescor8a <- cor(bes$immecon2[bes$all==0], bes$immecon3[bes$all==0], method="spearman", use="pairwise")
bescor9a <- cor(bes$immecon2[bes$all==0], bes$immecon4[bes$all==0], method="spearman", use="pairwise")
bescor10a <- cor(bes$immecon2[bes$all==0], bes$immecon7[bes$all==0], method="spearman", use="pairwise")
bescor11a <- cor(bes$immecon2[bes$all==0], bes$immecon8[bes$all==0], method="spearman", use="pairwise")
bescor12a <- cor(bes$immecon2[bes$all==0], bes$immecon10[bes$all==0], method="spearman", use="pairwise")
bescor13a <- cor(bes$immecon2[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")
bescor14a <- cor(bes$immecon3[bes$all==0], bes$immecon4[bes$all==0], method="spearman", use="pairwise")
bescor15a <- cor(bes$immecon3[bes$all==0], bes$immecon7[bes$all==0], method="spearman", use="pairwise")
bescor16a <- cor(bes$immecon3[bes$all==0], bes$immecon8[bes$all==0], method="spearman", use="pairwise")
bescor17a <- cor(bes$immecon3[bes$all==0], bes$immecon10[bes$all==0], method="spearman", use="pairwise")
bescor18a <- cor(bes$immecon3[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")
bescor19a <- cor(bes$immecon4[bes$all==0], bes$immecon7[bes$all==0], method="spearman", use="pairwise")
bescor20a <- cor(bes$immecon4[bes$all==0], bes$immecon8[bes$all==0], method="spearman", use="pairwise")
bescor21a <- cor(bes$immecon4[bes$all==0], bes$immecon10[bes$all==0], method="spearman", use="pairwise")
bescor22a <- cor(bes$immecon4[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")
bescor23a <- cor(bes$immecon7[bes$all==0], bes$immecon8[bes$all==0], method="spearman", use="pairwise")
bescor24a <- cor(bes$immecon7[bes$all==0], bes$immecon10[bes$all==0], method="spearman", use="pairwise")
bescor25a <- cor(bes$immecon7[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")
bescor26a <- cor(bes$immecon8[bes$all==0], bes$immecon10[bes$all==0], method="spearman", use="pairwise")
bescor27a <- cor(bes$immecon8[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")
bescor28a <- cor(bes$immecon10[bes$all==0], bes$immecon11[bes$all==0], method="spearman", use="pairwise")

bescor1b <- cor(bes$immecon1[bes$all==1], bes$immecon2[bes$all==1], method="spearman", use="pairwise")
bescor2b <- cor(bes$immecon1[bes$all==1], bes$immecon3[bes$all==1], method="spearman", use="pairwise")
bescor3b <- cor(bes$immecon1[bes$all==1], bes$immecon4[bes$all==1], method="spearman", use="pairwise")
bescor4b <- cor(bes$immecon1[bes$all==1], bes$immecon7[bes$all==1], method="spearman", use="pairwise")
bescor5b <- cor(bes$immecon1[bes$all==1], bes$immecon8[bes$all==1], method="spearman", use="pairwise")
bescor6b <- cor(bes$immecon1[bes$all==1], bes$immecon10[bes$all==1], method="spearman", use="pairwise")
bescor7b <- cor(bes$immecon1[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")
bescor8b <- cor(bes$immecon2[bes$all==1], bes$immecon3[bes$all==1], method="spearman", use="pairwise")
bescor9b <- cor(bes$immecon2[bes$all==1], bes$immecon4[bes$all==1], method="spearman", use="pairwise")
bescor10b <- cor(bes$immecon2[bes$all==1], bes$immecon7[bes$all==1], method="spearman", use="pairwise")
bescor11b <- cor(bes$immecon2[bes$all==1], bes$immecon8[bes$all==1], method="spearman", use="pairwise")
bescor12b <- cor(bes$immecon2[bes$all==1], bes$immecon10[bes$all==1], method="spearman", use="pairwise")
bescor13b <- cor(bes$immecon2[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")
bescor14b <- cor(bes$immecon3[bes$all==1], bes$immecon4[bes$all==1], method="spearman", use="pairwise")
bescor15b <- cor(bes$immecon3[bes$all==1], bes$immecon7[bes$all==1], method="spearman", use="pairwise")
bescor16b <- cor(bes$immecon3[bes$all==1], bes$immecon8[bes$all==1], method="spearman", use="pairwise")
bescor17b <- cor(bes$immecon3[bes$all==1], bes$immecon10[bes$all==1], method="spearman", use="pairwise")
bescor18b <- cor(bes$immecon3[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")
bescor19b <- cor(bes$immecon4[bes$all==1], bes$immecon7[bes$all==1], method="spearman", use="pairwise")
bescor20b <- cor(bes$immecon4[bes$all==1], bes$immecon8[bes$all==1], method="spearman", use="pairwise")
bescor21b <- cor(bes$immecon4[bes$all==1], bes$immecon10[bes$all==1], method="spearman", use="pairwise")
bescor22b <- cor(bes$immecon4[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")
bescor23b <- cor(bes$immecon7[bes$all==1], bes$immecon8[bes$all==1], method="spearman", use="pairwise")
bescor24b <- cor(bes$immecon7[bes$all==1], bes$immecon10[bes$all==1], method="spearman", use="pairwise")
bescor25b <- cor(bes$immecon7[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")
bescor26b <- cor(bes$immecon8[bes$all==1], bes$immecon10[bes$all==1], method="spearman", use="pairwise")
bescor27b <- cor(bes$immecon8[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")
bescor28b <- cor(bes$immecon10[bes$all==1], bes$immecon11[bes$all==1], method="spearman", use="pairwise")

bescor1diffa <- abs(bescor1a - bescor1b)
bescor2diffa <- abs(bescor2a - bescor2b)
bescor3diffa <- abs(bescor3a - bescor3b)
bescor4diffa <- abs(bescor4a - bescor4b)
bescor5diffa <- abs(bescor5a - bescor5b)
bescor6diffa <- abs(bescor6a - bescor6b)
bescor7diffa <- abs(bescor7a - bescor7b)
bescor8diffa <- abs(bescor8a - bescor8b)
bescor9diffa <- abs(bescor9a - bescor9b)
bescor10diffa <- abs(bescor10a - bescor10b)
bescor11diffa <- abs(bescor11a - bescor11b)
bescor12diffa <- abs(bescor12a - bescor12b)
bescor13diffa <- abs(bescor13a - bescor13b)
bescor14diffa <- abs(bescor14a - bescor14b)
bescor15diffa <- abs(bescor15a - bescor15b)
bescor16diffa <- abs(bescor16a - bescor16b)
bescor17diffa <- abs(bescor17a - bescor17b)
bescor18diffa <- abs(bescor18a - bescor18b)
bescor19diffa <- abs(bescor19a - bescor19b)
bescor20diffa <- abs(bescor20a - bescor20b)
bescor21diffa <- abs(bescor21a - bescor21b)
bescor22diffa <- abs(bescor22a - bescor22b)
bescor23diffa <- abs(bescor23a - bescor23b)
bescor24diffa <- abs(bescor24a - bescor24b)
bescor25diffa <- abs(bescor25a - bescor25b)
bescor26diffa <- abs(bescor26a - bescor26b)
bescor27diffa <- abs(bescor27a - bescor27b)
bescor28diffa <- abs(bescor28a - bescor28b)

bescor1diffb <- bescor1a - bescor1b
bescor2diffb <- bescor2a - bescor2b
bescor3diffb <- bescor3a - bescor3b
bescor4diffb <- bescor4a - bescor4b
bescor5diffb <- bescor5a - bescor5b
bescor6diffb <- bescor6a - bescor6b
bescor7diffb <- bescor7a - bescor7b
bescor8diffb <- bescor8a - bescor8b
bescor9diffb <- bescor9a - bescor9b
bescor10diffb <- bescor10a - bescor10b
bescor11diffb <- bescor11a - bescor11b
bescor12diffb <- bescor12a - bescor12b
bescor13diffb <- bescor13a - bescor13b
bescor14diffb <- bescor14a - bescor14b
bescor15diffb <- bescor15a - bescor15b
bescor16diffb <- bescor16a - bescor16b
bescor17diffb <- bescor17a - bescor17b
bescor18diffb <- bescor18a - bescor18b
bescor19diffb <- bescor19a - bescor19b
bescor20diffb <- bescor20a - bescor20b
bescor21diffb <- bescor21a - bescor21b
bescor22diffb <- bescor22a - bescor22b
bescor23diffb <- bescor23a - bescor23b
bescor24diffb <- bescor24a - bescor24b
bescor25diffb <- bescor25a - bescor25b
bescor26diffb <- bescor26a - bescor26b
bescor27diffb <- bescor27a - bescor27b
bescor28diffb <- bescor28a - bescor28b

bescordiff1 <- c(bescor1diffa, bescor2diffa, bescor3diffa, bescor4diffa, bescor5diffa, bescor6diffa, bescor7diffa, bescor8diffa, bescor9diffa, bescor10diffa, bescor11diffa, bescor12diffa, bescor13diffa, bescor14diffa, bescor15diffa, bescor16diffa, bescor17diffa, bescor18diffa, bescor19diffa, bescor20diffa, bescor21diffa, bescor22diffa, bescor23diffa, bescor24diffa, bescor25diffa, bescor26diffa, bescor27diffa, bescor28diffa)
bescordiff2 <- c(bescor1diffb, bescor2diffb, bescor3diffb, bescor4diffb, bescor5diffb, bescor6diffb, bescor7diffb, bescor8diffb, bescor9diffb, bescor10diffb, bescor11diffb, bescor12diffb, bescor13diffb, bescor14diffb, bescor15diffb, bescor16diffb, bescor17diffb, bescor18diffb, bescor19diffb, bescor20diffb, bescor21diffb, bescor22diffb, bescor23diffb, bescor24diffb, bescor25diffb, bescor26diffb, bescor27diffb, bescor28diffb)
bescordiffa1 <- sum(bescordiff1)/28
bescordiffb1 <- sum(bescordiff2)/28
bescor_max1 <- max(bescordiff1)

bescora1 <- c(bescor1a, bescor2a, bescor3a, bescor4a, bescor5a, bescor6a, bescor7a, bescor8a, bescor9a, bescor10a, bescor11a, bescor12a, bescor13a, bescor14a, bescor15a, bescor16a, bescor17a, bescor18a, bescor19a, bescor20a, bescor21a, bescor22a, bescor23a, bescor24a, bescor25a, bescor26a, bescor27a, bescor28a)

bescorb1 <- c(bescor1b, bescor2b, bescor3b, bescor4b, bescor5b, bescor6b, bescor7b, bescor8b, bescor9b, bescor10b, bescor11b, bescor12b, bescor13b, bescor14b, bescor15b, bescor16b, bescor17b, bescor18b, bescor19b, bescor20b, bescor21b, bescor22b, bescor23b, bescor24b, bescor25b, bescor26b, bescor27b, bescor28b)

## Culture

bescor1a <- cor(bes$immcul1[bes$all==0], bes$immcul2[bes$all==0], method="spearman", use="pairwise")
bescor2a <- cor(bes$immcul1[bes$all==0], bes$immcul3[bes$all==0], method="spearman", use="pairwise")
bescor3a <- cor(bes$immcul1[bes$all==0], bes$immcul4[bes$all==0], method="spearman", use="pairwise")
bescor4a <- cor(bes$immcul1[bes$all==0], bes$immcul7[bes$all==0], method="spearman", use="pairwise")
bescor5a <- cor(bes$immcul1[bes$all==0], bes$immcul8[bes$all==0], method="spearman", use="pairwise")
bescor6a <- cor(bes$immcul1[bes$all==0], bes$immcul10[bes$all==0], method="spearman", use="pairwise")
bescor7a <- cor(bes$immcul1[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")
bescor8a <- cor(bes$immcul2[bes$all==0], bes$immcul3[bes$all==0], method="spearman", use="pairwise")
bescor9a <- cor(bes$immcul2[bes$all==0], bes$immcul4[bes$all==0], method="spearman", use="pairwise")
bescor10a <- cor(bes$immcul2[bes$all==0], bes$immcul7[bes$all==0], method="spearman", use="pairwise")
bescor11a <- cor(bes$immcul2[bes$all==0], bes$immcul8[bes$all==0], method="spearman", use="pairwise")
bescor12a <- cor(bes$immcul2[bes$all==0], bes$immcul10[bes$all==0], method="spearman", use="pairwise")
bescor13a <- cor(bes$immcul2[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")
bescor14a <- cor(bes$immcul3[bes$all==0], bes$immcul4[bes$all==0], method="spearman", use="pairwise")
bescor15a <- cor(bes$immcul3[bes$all==0], bes$immcul7[bes$all==0], method="spearman", use="pairwise")
bescor16a <- cor(bes$immcul3[bes$all==0], bes$immcul8[bes$all==0], method="spearman", use="pairwise")
bescor17a <- cor(bes$immcul3[bes$all==0], bes$immcul10[bes$all==0], method="spearman", use="pairwise")
bescor18a <- cor(bes$immcul3[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")
bescor19a <- cor(bes$immcul4[bes$all==0], bes$immcul7[bes$all==0], method="spearman", use="pairwise")
bescor20a <- cor(bes$immcul4[bes$all==0], bes$immcul8[bes$all==0], method="spearman", use="pairwise")
bescor21a <- cor(bes$immcul4[bes$all==0], bes$immcul10[bes$all==0], method="spearman", use="pairwise")
bescor22a <- cor(bes$immcul4[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")
bescor23a <- cor(bes$immcul7[bes$all==0], bes$immcul8[bes$all==0], method="spearman", use="pairwise")
bescor24a <- cor(bes$immcul7[bes$all==0], bes$immcul10[bes$all==0], method="spearman", use="pairwise")
bescor25a <- cor(bes$immcul7[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")
bescor26a <- cor(bes$immcul8[bes$all==0], bes$immcul10[bes$all==0], method="spearman", use="pairwise")
bescor27a <- cor(bes$immcul8[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")
bescor28a <- cor(bes$immcul10[bes$all==0], bes$immcul11[bes$all==0], method="spearman", use="pairwise")

bescor1b <- cor(bes$immcul1[bes$all==1], bes$immcul2[bes$all==1], method="spearman", use="pairwise")
bescor2b <- cor(bes$immcul1[bes$all==1], bes$immcul3[bes$all==1], method="spearman", use="pairwise")
bescor3b <- cor(bes$immcul1[bes$all==1], bes$immcul4[bes$all==1], method="spearman", use="pairwise")
bescor4b <- cor(bes$immcul1[bes$all==1], bes$immcul7[bes$all==1], method="spearman", use="pairwise")
bescor5b <- cor(bes$immcul1[bes$all==1], bes$immcul8[bes$all==1], method="spearman", use="pairwise")
bescor6b <- cor(bes$immcul1[bes$all==1], bes$immcul10[bes$all==1], method="spearman", use="pairwise")
bescor7b <- cor(bes$immcul1[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")
bescor8b <- cor(bes$immcul2[bes$all==1], bes$immcul3[bes$all==1], method="spearman", use="pairwise")
bescor9b <- cor(bes$immcul2[bes$all==1], bes$immcul4[bes$all==1], method="spearman", use="pairwise")
bescor10b <- cor(bes$immcul2[bes$all==1], bes$immcul7[bes$all==1], method="spearman", use="pairwise")
bescor11b <- cor(bes$immcul2[bes$all==1], bes$immcul8[bes$all==1], method="spearman", use="pairwise")
bescor12b <- cor(bes$immcul2[bes$all==1], bes$immcul10[bes$all==1], method="spearman", use="pairwise")
bescor13b <- cor(bes$immcul2[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")
bescor14b <- cor(bes$immcul3[bes$all==1], bes$immcul4[bes$all==1], method="spearman", use="pairwise")
bescor15b <- cor(bes$immcul3[bes$all==1], bes$immcul7[bes$all==1], method="spearman", use="pairwise")
bescor16b <- cor(bes$immcul3[bes$all==1], bes$immcul8[bes$all==1], method="spearman", use="pairwise")
bescor17b <- cor(bes$immcul3[bes$all==1], bes$immcul10[bes$all==1], method="spearman", use="pairwise")
bescor18b <- cor(bes$immcul3[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")
bescor19b <- cor(bes$immcul4[bes$all==1], bes$immcul7[bes$all==1], method="spearman", use="pairwise")
bescor20b <- cor(bes$immcul4[bes$all==1], bes$immcul8[bes$all==1], method="spearman", use="pairwise")
bescor21b <- cor(bes$immcul4[bes$all==1], bes$immcul10[bes$all==1], method="spearman", use="pairwise")
bescor22b <- cor(bes$immcul4[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")
bescor23b <- cor(bes$immcul7[bes$all==1], bes$immcul8[bes$all==1], method="spearman", use="pairwise")
bescor24b <- cor(bes$immcul7[bes$all==1], bes$immcul10[bes$all==1], method="spearman", use="pairwise")
bescor25b <- cor(bes$immcul7[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")
bescor26b <- cor(bes$immcul8[bes$all==1], bes$immcul10[bes$all==1], method="spearman", use="pairwise")
bescor27b <- cor(bes$immcul8[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")
bescor28b <- cor(bes$immcul10[bes$all==1], bes$immcul11[bes$all==1], method="spearman", use="pairwise")

bescor1diffa <- abs(bescor1a - bescor1b)
bescor2diffa <- abs(bescor2a - bescor2b)
bescor3diffa <- abs(bescor3a - bescor3b)
bescor4diffa <- abs(bescor4a - bescor4b)
bescor5diffa <- abs(bescor5a - bescor5b)
bescor6diffa <- abs(bescor6a - bescor6b)
bescor7diffa <- abs(bescor7a - bescor7b)
bescor8diffa <- abs(bescor8a - bescor8b)
bescor9diffa <- abs(bescor9a - bescor9b)
bescor10diffa <- abs(bescor10a - bescor10b)
bescor11diffa <- abs(bescor11a - bescor11b)
bescor12diffa <- abs(bescor12a - bescor12b)
bescor13diffa <- abs(bescor13a - bescor13b)
bescor14diffa <- abs(bescor14a - bescor14b)
bescor15diffa <- abs(bescor15a - bescor15b)
bescor16diffa <- abs(bescor16a - bescor16b)
bescor17diffa <- abs(bescor17a - bescor17b)
bescor18diffa <- abs(bescor18a - bescor18b)
bescor19diffa <- abs(bescor19a - bescor19b)
bescor20diffa <- abs(bescor20a - bescor20b)
bescor21diffa <- abs(bescor21a - bescor21b)
bescor22diffa <- abs(bescor22a - bescor22b)
bescor23diffa <- abs(bescor23a - bescor23b)
bescor24diffa <- abs(bescor24a - bescor24b)
bescor25diffa <- abs(bescor25a - bescor25b)
bescor26diffa <- abs(bescor26a - bescor26b)
bescor27diffa <- abs(bescor27a - bescor27b)
bescor28diffa <- abs(bescor28a - bescor28b)

bescor1diffb <- bescor1a - bescor1b
bescor2diffb <- bescor2a - bescor2b
bescor3diffb <- bescor3a - bescor3b
bescor4diffb <- bescor4a - bescor4b
bescor5diffb <- bescor5a - bescor5b
bescor6diffb <- bescor6a - bescor6b
bescor7diffb <- bescor7a - bescor7b
bescor8diffb <- bescor8a - bescor8b
bescor9diffb <- bescor9a - bescor9b
bescor10diffb <- bescor10a - bescor10b
bescor11diffb <- bescor11a - bescor11b
bescor12diffb <- bescor12a - bescor12b
bescor13diffb <- bescor13a - bescor13b
bescor14diffb <- bescor14a - bescor14b
bescor15diffb <- bescor15a - bescor15b
bescor16diffb <- bescor16a - bescor16b
bescor17diffb <- bescor17a - bescor17b
bescor18diffb <- bescor18a - bescor18b
bescor19diffb <- bescor19a - bescor19b
bescor20diffb <- bescor20a - bescor20b
bescor21diffb <- bescor21a - bescor21b
bescor22diffb <- bescor22a - bescor22b
bescor23diffb <- bescor23a - bescor23b
bescor24diffb <- bescor24a - bescor24b
bescor25diffb <- bescor25a - bescor25b
bescor26diffb <- bescor26a - bescor26b
bescor27diffb <- bescor27a - bescor27b
bescor28diffb <- bescor28a - bescor28b

bescordiff1 <- c(bescor1diffa, bescor2diffa, bescor3diffa, bescor4diffa, bescor5diffa, bescor6diffa, bescor7diffa, bescor8diffa, bescor9diffa, bescor10diffa, bescor11diffa, bescor12diffa, bescor13diffa, bescor14diffa, bescor15diffa, bescor16diffa, bescor17diffa, bescor18diffa, bescor19diffa, bescor20diffa, bescor21diffa, bescor22diffa, bescor23diffa, bescor24diffa, bescor25diffa, bescor26diffa, bescor27diffa, bescor28diffa)
bescordiff2 <- c(bescor1diffb, bescor2diffb, bescor3diffb, bescor4diffb, bescor5diffb, bescor6diffb, bescor7diffb, bescor8diffb, bescor9diffb, bescor10diffb, bescor11diffb, bescor12diffb, bescor13diffb, bescor14diffb, bescor15diffb, bescor16diffb, bescor17diffb, bescor18diffb, bescor19diffb, bescor20diffb, bescor21diffb, bescor22diffb, bescor23diffb, bescor24diffb, bescor25diffb, bescor26diffb, bescor27diffb, bescor28diffb)
bescordiffa2 <- sum(bescordiff1)/28
bescordiffb2 <- sum(bescordiff2)/28
bescor_max2 <- max(bescordiff1)

bescora2 <- c(bescor1a, bescor2a, bescor3a, bescor4a, bescor5a, bescor6a, bescor7a, bescor8a, bescor9a, bescor10a, bescor11a, bescor12a, bescor13a, bescor14a, bescor15a, bescor16a, bescor17a, bescor18a, bescor19a, bescor20a, bescor21a, bescor22a, bescor23a, bescor24a, bescor25a, bescor26a, bescor27a, bescor28a)

bescorb2 <- c(bescor1b, bescor2b, bescor3b, bescor4b, bescor5b, bescor6b, bescor7b, bescor8b, bescor9b, bescor10b, bescor11b, bescor12b, bescor13b, bescor14b, bescor15b, bescor16b, bescor17b, bescor18b, bescor19b, bescor20b, bescor21b, bescor22b, bescor23b, bescor24b, bescor25b, bescor26b, bescor27b, bescor28b)

## Welfare

bescor1a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare2[bes$all==0], method="spearman", use="pairwise")
bescor2a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare3[bes$all==0], method="spearman", use="pairwise")
bescor3a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare4[bes$all==0], method="spearman", use="pairwise")
bescor4a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare7[bes$all==0], method="spearman", use="pairwise")
bescor5a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare8[bes$all==0], method="spearman", use="pairwise")
bescor6a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare10[bes$all==0], method="spearman", use="pairwise")
bescor7a <- cor(bes$immwelfare1[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")
bescor8a <- cor(bes$immwelfare2[bes$all==0], bes$immwelfare3[bes$all==0], method="spearman", use="pairwise")
bescor9a <- cor(bes$immwelfare2[bes$all==0], bes$immwelfare4[bes$all==0], method="spearman", use="pairwise")
bescor10a <- cor(bes$immwelfare2[bes$all==0], bes$immwelfare7[bes$all==0], method="spearman", use="pairwise")
bescor11a <- cor(bes$immwelfare2[bes$all==0], bes$immwelfare8[bes$all==0], method="spearman", use="pairwise")
bescor12a <- cor(bes$immwelfare2[bes$all==0], bes$immwelfare10[bes$all==0], method="spearman", use="pairwise")
bescor13a <- cor(bes$immwelfare2[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")
bescor14a <- cor(bes$immwelfare3[bes$all==0], bes$immwelfare4[bes$all==0], method="spearman", use="pairwise")
bescor15a <- cor(bes$immwelfare3[bes$all==0], bes$immwelfare7[bes$all==0], method="spearman", use="pairwise")
bescor16a <- cor(bes$immwelfare3[bes$all==0], bes$immwelfare8[bes$all==0], method="spearman", use="pairwise")
bescor17a <- cor(bes$immwelfare3[bes$all==0], bes$immwelfare10[bes$all==0], method="spearman", use="pairwise")
bescor18a <- cor(bes$immwelfare3[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")
bescor19a <- cor(bes$immwelfare4[bes$all==0], bes$immwelfare7[bes$all==0], method="spearman", use="pairwise")
bescor20a <- cor(bes$immwelfare4[bes$all==0], bes$immwelfare8[bes$all==0], method="spearman", use="pairwise")
bescor21a <- cor(bes$immwelfare4[bes$all==0], bes$immwelfare10[bes$all==0], method="spearman", use="pairwise")
bescor22a <- cor(bes$immwelfare4[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")
bescor23a <- cor(bes$immwelfare7[bes$all==0], bes$immwelfare8[bes$all==0], method="spearman", use="pairwise")
bescor24a <- cor(bes$immwelfare7[bes$all==0], bes$immwelfare10[bes$all==0], method="spearman", use="pairwise")
bescor25a <- cor(bes$immwelfare7[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")
bescor26a <- cor(bes$immwelfare8[bes$all==0], bes$immwelfare10[bes$all==0], method="spearman", use="pairwise")
bescor27a <- cor(bes$immwelfare8[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")
bescor28a <- cor(bes$immwelfare10[bes$all==0], bes$immwelfare11[bes$all==0], method="spearman", use="pairwise")

bescor1b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare2[bes$all==1], method="spearman", use="pairwise")
bescor2b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare3[bes$all==1], method="spearman", use="pairwise")
bescor3b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare4[bes$all==1], method="spearman", use="pairwise")
bescor4b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare7[bes$all==1], method="spearman", use="pairwise")
bescor5b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare8[bes$all==1], method="spearman", use="pairwise")
bescor6b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare10[bes$all==1], method="spearman", use="pairwise")
bescor7b <- cor(bes$immwelfare1[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")
bescor8b <- cor(bes$immwelfare2[bes$all==1], bes$immwelfare3[bes$all==1], method="spearman", use="pairwise")
bescor9b <- cor(bes$immwelfare2[bes$all==1], bes$immwelfare4[bes$all==1], method="spearman", use="pairwise")
bescor10b <- cor(bes$immwelfare2[bes$all==1], bes$immwelfare7[bes$all==1], method="spearman", use="pairwise")
bescor11b <- cor(bes$immwelfare2[bes$all==1], bes$immwelfare8[bes$all==1], method="spearman", use="pairwise")
bescor12b <- cor(bes$immwelfare2[bes$all==1], bes$immwelfare10[bes$all==1], method="spearman", use="pairwise")
bescor13b <- cor(bes$immwelfare2[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")
bescor14b <- cor(bes$immwelfare3[bes$all==1], bes$immwelfare4[bes$all==1], method="spearman", use="pairwise")
bescor15b <- cor(bes$immwelfare3[bes$all==1], bes$immwelfare7[bes$all==1], method="spearman", use="pairwise")
bescor16b <- cor(bes$immwelfare3[bes$all==1], bes$immwelfare8[bes$all==1], method="spearman", use="pairwise")
bescor17b <- cor(bes$immwelfare3[bes$all==1], bes$immwelfare10[bes$all==1], method="spearman", use="pairwise")
bescor18b <- cor(bes$immwelfare3[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")
bescor19b <- cor(bes$immwelfare4[bes$all==1], bes$immwelfare7[bes$all==1], method="spearman", use="pairwise")
bescor20b <- cor(bes$immwelfare4[bes$all==1], bes$immwelfare8[bes$all==1], method="spearman", use="pairwise")
bescor21b <- cor(bes$immwelfare4[bes$all==1], bes$immwelfare10[bes$all==1], method="spearman", use="pairwise")
bescor22b <- cor(bes$immwelfare4[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")
bescor23b <- cor(bes$immwelfare7[bes$all==1], bes$immwelfare8[bes$all==1], method="spearman", use="pairwise")
bescor24b <- cor(bes$immwelfare7[bes$all==1], bes$immwelfare10[bes$all==1], method="spearman", use="pairwise")
bescor25b <- cor(bes$immwelfare7[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")
bescor26b <- cor(bes$immwelfare8[bes$all==1], bes$immwelfare10[bes$all==1], method="spearman", use="pairwise")
bescor27b <- cor(bes$immwelfare8[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")
bescor28b <- cor(bes$immwelfare10[bes$all==1], bes$immwelfare11[bes$all==1], method="spearman", use="pairwise")


bescor1diffa <- abs(bescor1a - bescor1b)
bescor2diffa <- abs(bescor2a - bescor2b)
bescor3diffa <- abs(bescor3a - bescor3b)
bescor4diffa <- abs(bescor4a - bescor4b)
bescor5diffa <- abs(bescor5a - bescor5b)
bescor6diffa <- abs(bescor6a - bescor6b)
bescor7diffa <- abs(bescor7a - bescor7b)
bescor8diffa <- abs(bescor8a - bescor8b)
bescor9diffa <- abs(bescor9a - bescor9b)
bescor10diffa <- abs(bescor10a - bescor10b)
bescor11diffa <- abs(bescor11a - bescor11b)
bescor12diffa <- abs(bescor12a - bescor12b)
bescor13diffa <- abs(bescor13a - bescor13b)
bescor14diffa <- abs(bescor14a - bescor14b)
bescor15diffa <- abs(bescor15a - bescor15b)
bescor16diffa <- abs(bescor16a - bescor16b)
bescor17diffa <- abs(bescor17a - bescor17b)
bescor18diffa <- abs(bescor18a - bescor18b)
bescor19diffa <- abs(bescor19a - bescor19b)
bescor20diffa <- abs(bescor20a - bescor20b)
bescor21diffa <- abs(bescor21a - bescor21b)
bescor22diffa <- abs(bescor22a - bescor22b)
bescor23diffa <- abs(bescor23a - bescor23b)
bescor24diffa <- abs(bescor24a - bescor24b)
bescor25diffa <- abs(bescor25a - bescor25b)
bescor26diffa <- abs(bescor26a - bescor26b)
bescor27diffa <- abs(bescor27a - bescor27b)
bescor28diffa <- abs(bescor28a - bescor28b)

bescor1diffb <- bescor1a - bescor1b
bescor2diffb <- bescor2a - bescor2b
bescor3diffb <- bescor3a - bescor3b
bescor4diffb <- bescor4a - bescor4b
bescor5diffb <- bescor5a - bescor5b
bescor6diffb <- bescor6a - bescor6b
bescor7diffb <- bescor7a - bescor7b
bescor8diffb <- bescor8a - bescor8b
bescor9diffb <- bescor9a - bescor9b
bescor10diffb <- bescor10a - bescor10b
bescor11diffb <- bescor11a - bescor11b
bescor12diffb <- bescor12a - bescor12b
bescor13diffb <- bescor13a - bescor13b
bescor14diffb <- bescor14a - bescor14b
bescor15diffb <- bescor15a - bescor15b
bescor16diffb <- bescor16a - bescor16b
bescor17diffb <- bescor17a - bescor17b
bescor18diffb <- bescor18a - bescor18b
bescor19diffb <- bescor19a - bescor19b
bescor20diffb <- bescor20a - bescor20b
bescor21diffb <- bescor21a - bescor21b
bescor22diffb <- bescor22a - bescor22b
bescor23diffb <- bescor23a - bescor23b
bescor24diffb <- bescor24a - bescor24b
bescor25diffb <- bescor25a - bescor25b
bescor26diffb <- bescor26a - bescor26b
bescor27diffb <- bescor27a - bescor27b
bescor28diffb <- bescor28a - bescor28b

bescordiff1 <- c(bescor1diffa, bescor2diffa, bescor3diffa, bescor4diffa, bescor5diffa, bescor6diffa, bescor7diffa, bescor8diffa, bescor9diffa, bescor10diffa, bescor11diffa, bescor12diffa, bescor13diffa, bescor14diffa, bescor15diffa, bescor16diffa, bescor17diffa, bescor18diffa, bescor19diffa, bescor20diffa, bescor21diffa, bescor22diffa, bescor23diffa, bescor24diffa, bescor25diffa, bescor26diffa, bescor27diffa, bescor28diffa)
bescordiff2 <- c(bescor1diffb, bescor2diffb, bescor3diffb, bescor4diffb, bescor5diffb, bescor6diffb, bescor7diffb, bescor8diffb, bescor9diffb, bescor10diffb, bescor11diffb, bescor12diffb, bescor13diffb, bescor14diffb, bescor15diffb, bescor16diffb, bescor17diffb, bescor18diffb, bescor19diffb, bescor20diffb, bescor21diffb, bescor22diffb, bescor23diffb, bescor24diffb, bescor25diffb, bescor26diffb, bescor27diffb, bescor28diffb)
bescordiffa3 <- sum(bescordiff1)/28
bescordiffb3 <- sum(bescordiff2)/28
bescor_max3 <- max(bescordiff1)

bescora3 <- c(bescor1a, bescor2a, bescor3a, bescor4a, bescor5a, bescor6a, bescor7a, bescor8a, bescor9a, bescor10a, bescor11a, bescor12a, bescor13a, bescor14a, bescor15a, bescor16a, bescor17a, bescor18a, bescor19a, bescor20a, bescor21a, bescor22a, bescor23a, bescor24a, bescor25a, bescor26a, bescor27a, bescor28a)

bescorb3 <- c(bescor1b, bescor2b, bescor3b, bescor4b, bescor5b, bescor6b, bescor7b, bescor8b, bescor9b, bescor10b, bescor11b, bescor12b, bescor13b, bescor14b, bescor15b, bescor16b, bescor17b, bescor18b, bescor19b, bescor20b, bescor21b, bescor22b, bescor23b, bescor24b, bescor25b, bescor26b, bescor27b, bescor28b)

bescoria <- (bescordiffa1 + bescordiffa2 + bescordiffa3)/3
bescorib <- (bescordiffb1 + bescordiffb2 + bescordiffb3)/3

bescor_max <- c(bescor_max1, bescor_max2, bescor_max3)
bescor_max <- max(bescor_max)

#######################
###### NCP PANEL ######
#######################

##Question 1

ncpcor1a <- cor(ncp$imm1_3[ncp$all==0], ncp$imm1_4[ncp$all==0], method="spearman", use="pairwise")
ncpcor2a <- cor(ncp$imm1_3[ncp$all==0], ncp$imm1_5[ncp$all==0], method="spearman", use="pairwise")
ncpcor3a <- cor(ncp$imm1_3[ncp$all==0], ncp$imm1_6[ncp$all==0], method="spearman", use="pairwise")
ncpcor4a <- cor(ncp$imm1_3[ncp$all==0], ncp$imm1_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor5a <- cor(ncp$imm1_3[ncp$all==0], ncp$imm1_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor6a <- cor(ncp$imm1_4[ncp$all==0], ncp$imm1_5[ncp$all==0], method="spearman", use="pairwise")
ncpcor7a <- cor(ncp$imm1_4[ncp$all==0], ncp$imm1_6[ncp$all==0], method="spearman", use="pairwise")
ncpcor8a <- cor(ncp$imm1_4[ncp$all==0], ncp$imm1_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor9a <- cor(ncp$imm1_4[ncp$all==0], ncp$imm1_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor10a <- cor(ncp$imm1_5[ncp$all==0], ncp$imm1_6[ncp$all==0], method="spearman", use="pairwise")
ncpcor11a <- cor(ncp$imm1_5[ncp$all==0], ncp$imm1_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor12a <- cor(ncp$imm1_5[ncp$all==0], ncp$imm1_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor13a <- cor(ncp$imm1_6[ncp$all==0], ncp$imm1_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor14a <- cor(ncp$imm1_6[ncp$all==0], ncp$imm1_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor15a <- cor(ncp$imm1_7[ncp$all==0], ncp$imm1_8[ncp$all==0], method="spearman", use="pairwise")

ncpcor1b <- cor(ncp$imm1_3[ncp$all==1], ncp$imm1_4[ncp$all==1], method="spearman", use="pairwise")
ncpcor2b <- cor(ncp$imm1_3[ncp$all==1], ncp$imm1_5[ncp$all==1], method="spearman", use="pairwise")
ncpcor3b <- cor(ncp$imm1_3[ncp$all==1], ncp$imm1_6[ncp$all==1], method="spearman", use="pairwise")
ncpcor4b <- cor(ncp$imm1_3[ncp$all==1], ncp$imm1_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor5b <- cor(ncp$imm1_3[ncp$all==1], ncp$imm1_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor6b <- cor(ncp$imm1_4[ncp$all==1], ncp$imm1_5[ncp$all==1], method="spearman", use="pairwise")
ncpcor7b <- cor(ncp$imm1_4[ncp$all==1], ncp$imm1_6[ncp$all==1], method="spearman", use="pairwise")
ncpcor8b <- cor(ncp$imm1_4[ncp$all==1], ncp$imm1_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor9b <- cor(ncp$imm1_4[ncp$all==1], ncp$imm1_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor10b <- cor(ncp$imm1_5[ncp$all==1], ncp$imm1_6[ncp$all==1], method="spearman", use="pairwise")
ncpcor11b <- cor(ncp$imm1_5[ncp$all==1], ncp$imm1_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor12b <- cor(ncp$imm1_5[ncp$all==1], ncp$imm1_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor13b <- cor(ncp$imm1_6[ncp$all==1], ncp$imm1_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor14b <- cor(ncp$imm1_6[ncp$all==1], ncp$imm1_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor15b <- cor(ncp$imm1_7[ncp$all==1], ncp$imm1_8[ncp$all==1], method="spearman", use="pairwise")

ncpcor1diffa <- abs(ncpcor1a - ncpcor1b)
ncpcor2diffa <- abs(ncpcor2a - ncpcor2b)
ncpcor3diffa <- abs(ncpcor3a - ncpcor3b)
ncpcor4diffa <- abs(ncpcor4a - ncpcor4b)
ncpcor5diffa <- abs(ncpcor5a - ncpcor5b)
ncpcor6diffa <- abs(ncpcor6a - ncpcor6b)
ncpcor7diffa <- abs(ncpcor7a - ncpcor7b)
ncpcor8diffa <- abs(ncpcor8a - ncpcor8b)
ncpcor9diffa <- abs(ncpcor9a - ncpcor9b)
ncpcor10diffa <- abs(ncpcor10a - ncpcor10b)
ncpcor11diffa <- abs(ncpcor11a - ncpcor11b)
ncpcor12diffa <- abs(ncpcor12a - ncpcor12b)
ncpcor13diffa <- abs(ncpcor13a - ncpcor13b)
ncpcor14diffa <- abs(ncpcor14a - ncpcor14b)
ncpcor15diffa <- abs(ncpcor15a - ncpcor15b)

ncpcor1diffb <- ncpcor1a - ncpcor1b
ncpcor2diffb <- ncpcor2a - ncpcor2b
ncpcor3diffb <- ncpcor3a - ncpcor3b
ncpcor4diffb <- ncpcor4a - ncpcor4b
ncpcor5diffb <- ncpcor5a - ncpcor5b
ncpcor6diffb <- ncpcor6a - ncpcor6b
ncpcor7diffb <- ncpcor7a - ncpcor7b
ncpcor8diffb <- ncpcor8a - ncpcor8b
ncpcor9diffb <- ncpcor9a - ncpcor9b
ncpcor10diffb <- ncpcor10a - ncpcor10b
ncpcor11diffb <- ncpcor11a - ncpcor11b
ncpcor12diffb <- ncpcor12a - ncpcor12b
ncpcor13diffb <- ncpcor13a - ncpcor13b
ncpcor14diffb <- ncpcor14a - ncpcor14b
ncpcor15diffb <- ncpcor15a - ncpcor15b


ncpcordiff1 <- c(ncpcor1diffa, ncpcor2diffa, ncpcor3diffa, ncpcor4diffa, ncpcor5diffa, ncpcor6diffa, ncpcor7diffa, ncpcor8diffa, ncpcor9diffa, ncpcor10diffa, ncpcor11diffa, ncpcor12diffa, ncpcor13diffa, ncpcor14diffa, ncpcor15diffa)
ncpcordiff2 <- c(ncpcor1diffb, ncpcor2diffb, ncpcor3diffb, ncpcor4diffb, ncpcor5diffb, ncpcor6diffb, ncpcor7diffb, ncpcor8diffb, ncpcor9diffb, ncpcor10diffb, ncpcor11diffb, ncpcor12diffb, ncpcor13diffb, ncpcor14diffb, ncpcor15diffb)
ncpcordiffa1 <- sum(ncpcordiff1)/15
ncpcordiffb1 <- sum(ncpcordiff2)/15
ncpcor_max1 <- max(ncpcordiff1)

ncpcora1 <- c(ncpcor1a, ncpcor2a, ncpcor3a, ncpcor4a, ncpcor5a, ncpcor6a, ncpcor7a, ncpcor8a, ncpcor9a, ncpcor10a, ncpcor11a, ncpcor12a, ncpcor13a, ncpcor14a, ncpcor15a)

ncpcorb1 <- c(ncpcor1b, ncpcor2b, ncpcor3b, ncpcor4b, ncpcor5b, ncpcor6b, ncpcor7b, ncpcor8b, ncpcor9b, ncpcor10b, ncpcor11b, ncpcor12b, ncpcor13b, ncpcor14b, ncpcor15b)

## Question 2

ncpcor1a <- cor(ncp$imm2_3[ncp$all==0], ncp$imm2_4[ncp$all==0], method="spearman", use="pairwise")
ncpcor2a <- cor(ncp$imm2_3[ncp$all==0], ncp$imm2_5[ncp$all==0], method="spearman", use="pairwise")
ncpcor3a <- cor(ncp$imm2_3[ncp$all==0], ncp$imm2_6[ncp$all==0], method="spearman", use="pairwise")
ncpcor4a <- cor(ncp$imm2_3[ncp$all==0], ncp$imm2_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor5a <- cor(ncp$imm2_3[ncp$all==0], ncp$imm2_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor6a <- cor(ncp$imm2_4[ncp$all==0], ncp$imm2_5[ncp$all==0], method="spearman", use="pairwise")
ncpcor7a <- cor(ncp$imm2_4[ncp$all==0], ncp$imm2_6[ncp$all==0], method="spearman", use="pairwise")
ncpcor8a <- cor(ncp$imm2_4[ncp$all==0], ncp$imm2_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor9a <- cor(ncp$imm2_4[ncp$all==0], ncp$imm2_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor10a <- cor(ncp$imm2_5[ncp$all==0], ncp$imm2_6[ncp$all==0], method="spearman", use="pairwise")
ncpcor11a <- cor(ncp$imm2_5[ncp$all==0], ncp$imm2_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor12a <- cor(ncp$imm2_5[ncp$all==0], ncp$imm2_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor13a <- cor(ncp$imm2_6[ncp$all==0], ncp$imm2_7[ncp$all==0], method="spearman", use="pairwise")
ncpcor14a <- cor(ncp$imm2_6[ncp$all==0], ncp$imm2_8[ncp$all==0], method="spearman", use="pairwise")
ncpcor15a <- cor(ncp$imm2_7[ncp$all==0], ncp$imm2_8[ncp$all==0], method="spearman", use="pairwise")

ncpcor1b <- cor(ncp$imm2_3[ncp$all==1], ncp$imm2_4[ncp$all==1], method="spearman", use="pairwise")
ncpcor2b <- cor(ncp$imm2_3[ncp$all==1], ncp$imm2_5[ncp$all==1], method="spearman", use="pairwise")
ncpcor3b <- cor(ncp$imm2_3[ncp$all==1], ncp$imm2_6[ncp$all==1], method="spearman", use="pairwise")
ncpcor4b <- cor(ncp$imm2_3[ncp$all==1], ncp$imm2_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor5b <- cor(ncp$imm2_3[ncp$all==1], ncp$imm2_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor6b <- cor(ncp$imm2_4[ncp$all==1], ncp$imm2_5[ncp$all==1], method="spearman", use="pairwise")
ncpcor7b <- cor(ncp$imm2_4[ncp$all==1], ncp$imm2_6[ncp$all==1], method="spearman", use="pairwise")
ncpcor8b <- cor(ncp$imm2_4[ncp$all==1], ncp$imm2_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor9b <- cor(ncp$imm2_4[ncp$all==1], ncp$imm2_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor10b <- cor(ncp$imm2_5[ncp$all==1], ncp$imm2_6[ncp$all==1], method="spearman", use="pairwise")
ncpcor11b <- cor(ncp$imm2_5[ncp$all==1], ncp$imm2_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor12b <- cor(ncp$imm2_5[ncp$all==1], ncp$imm2_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor13b <- cor(ncp$imm2_6[ncp$all==1], ncp$imm2_7[ncp$all==1], method="spearman", use="pairwise")
ncpcor14b <- cor(ncp$imm2_6[ncp$all==1], ncp$imm2_8[ncp$all==1], method="spearman", use="pairwise")
ncpcor15b <- cor(ncp$imm2_7[ncp$all==1], ncp$imm2_8[ncp$all==1], method="spearman", use="pairwise")

ncpcor1diffa <- abs(ncpcor1a - ncpcor1b)
ncpcor2diffa <- abs(ncpcor2a - ncpcor2b)
ncpcor3diffa <- abs(ncpcor3a - ncpcor3b)
ncpcor4diffa <- abs(ncpcor4a - ncpcor4b)
ncpcor5diffa <- abs(ncpcor5a - ncpcor5b)
ncpcor6diffa <- abs(ncpcor6a - ncpcor6b)
ncpcor7diffa <- abs(ncpcor7a - ncpcor7b)
ncpcor8diffa <- abs(ncpcor8a - ncpcor8b)
ncpcor9diffa <- abs(ncpcor9a - ncpcor9b)
ncpcor10diffa <- abs(ncpcor10a - ncpcor10b)
ncpcor11diffa <- abs(ncpcor11a - ncpcor11b)
ncpcor12diffa <- abs(ncpcor12a - ncpcor12b)
ncpcor13diffa <- abs(ncpcor13a - ncpcor13b)
ncpcor14diffa <- abs(ncpcor14a - ncpcor14b)
ncpcor15diffa <- abs(ncpcor15a - ncpcor15b)

ncpcor1diffb <- ncpcor1a - ncpcor1b
ncpcor2diffb <- ncpcor2a - ncpcor2b
ncpcor3diffb <- ncpcor3a - ncpcor3b
ncpcor4diffb <- ncpcor4a - ncpcor4b
ncpcor5diffb <- ncpcor5a - ncpcor5b
ncpcor6diffb <- ncpcor6a - ncpcor6b
ncpcor7diffb <- ncpcor7a - ncpcor7b
ncpcor8diffb <- ncpcor8a - ncpcor8b
ncpcor9diffb <- ncpcor9a - ncpcor9b
ncpcor10diffb <- ncpcor10a - ncpcor10b
ncpcor11diffb <- ncpcor11a - ncpcor11b
ncpcor12diffb <- ncpcor12a - ncpcor12b
ncpcor13diffb <- ncpcor13a - ncpcor13b
ncpcor14diffb <- ncpcor14a - ncpcor14b
ncpcor15diffb <- ncpcor15a - ncpcor15b

ncpcordiff1 <- c(ncpcor1diffa, ncpcor2diffa, ncpcor3diffa, ncpcor4diffa, ncpcor5diffa, ncpcor6diffa, ncpcor7diffa, ncpcor8diffa, ncpcor9diffa, ncpcor10diffa, ncpcor11diffa, ncpcor12diffa, ncpcor13diffa, ncpcor14diffa, ncpcor15diffa)
ncpcordiff2 <- c(ncpcor1diffb, ncpcor2diffb, ncpcor3diffb, ncpcor4diffb, ncpcor5diffb, ncpcor6diffb, ncpcor7diffb, ncpcor8diffb, ncpcor9diffb, ncpcor10diffb, ncpcor11diffb, ncpcor12diffb, ncpcor13diffb, ncpcor14diffb, ncpcor15diffb)
ncpcordiffa2 <- sum(ncpcordiff1)/15
ncpcordiffb2 <- sum(ncpcordiff2)/15
ncpcor_max2 <- max(ncpcordiff1)

ncpcora2 <- c(ncpcor1a, ncpcor2a, ncpcor3a, ncpcor4a, ncpcor5a, ncpcor6a, ncpcor7a, ncpcor8a, ncpcor9a, ncpcor10a, ncpcor11a, ncpcor12a, ncpcor13a, ncpcor14a, ncpcor15a)

ncpcorb2 <- c(ncpcor1b, ncpcor2b, ncpcor3b, ncpcor4b, ncpcor5b, ncpcor6b, ncpcor7b, ncpcor8b, ncpcor9b, ncpcor10b, ncpcor11b, ncpcor12b, ncpcor13b, ncpcor14b, ncpcor15b)

ncpcoria <- (ncpcordiffa1 + ncpcordiffa2)/2
ncpcorib <- (ncpcordiffb1 + ncpcordiffb2)/2
ncpcor_max <- c(ncpcor_max1, ncpcor_max2)
ncpcor_max <- max(ncpcor_max)

##################
####INES Panel####
##################

inescor1a <- cor(ines$imm2[ines$all==0], ines$imm3[ines$all==0], method="spearman", use="pairwise")
inescor2a <- cor(ines$imm2[ines$all==0], ines$imm4[ines$all==0], method="spearman", use="pairwise")
inescor3a <- cor(ines$imm2[ines$all==0], ines$imm6[ines$all==0], method="spearman", use="pairwise")
inescor4a <- cor(ines$imm2[ines$all==0], ines$imm7[ines$all==0], method="spearman", use="pairwise")
inescor5a <- cor(ines$imm3[ines$all==0], ines$imm4[ines$all==0], method="spearman", use="pairwise")
inescor6a <- cor(ines$imm3[ines$all==0], ines$imm6[ines$all==0], method="spearman", use="pairwise")
inescor7a <- cor(ines$imm3[ines$all==0], ines$imm7[ines$all==0], method="spearman", use="pairwise")
inescor8a <- cor(ines$imm4[ines$all==0], ines$imm6[ines$all==0], method="spearman", use="pairwise")
inescor9a <- cor(ines$imm4[ines$all==0], ines$imm7[ines$all==0], method="spearman", use="pairwise")
inescor10a <- cor(ines$imm6[ines$all==0], ines$imm7[ines$all==0], method="spearman", use="pairwise")

inescor1b <- cor(ines$imm2[ines$all==1], ines$imm3[ines$all==1], method="spearman", use="pairwise")
inescor2b <- cor(ines$imm2[ines$all==1], ines$imm4[ines$all==1], method="spearman", use="pairwise")
inescor3b <- cor(ines$imm2[ines$all==1], ines$imm6[ines$all==1], method="spearman", use="pairwise")
inescor4b <- cor(ines$imm2[ines$all==1], ines$imm7[ines$all==1], method="spearman", use="pairwise")
inescor5b <- cor(ines$imm3[ines$all==1], ines$imm4[ines$all==1], method="spearman", use="pairwise")
inescor6b <- cor(ines$imm3[ines$all==1], ines$imm6[ines$all==1], method="spearman", use="pairwise")
inescor7b <- cor(ines$imm3[ines$all==1], ines$imm7[ines$all==1], method="spearman", use="pairwise")
inescor8b <- cor(ines$imm4[ines$all==1], ines$imm6[ines$all==1], method="spearman", use="pairwise")
inescor9b <- cor(ines$imm4[ines$all==1], ines$imm7[ines$all==1], method="spearman", use="pairwise")
inescor10b <- cor(ines$imm6[ines$all==1], ines$imm7[ines$all==1], method="spearman", use="pairwise")

inescor1diffa <- abs(inescor1a - inescor1b)
inescor2diffa <- abs(inescor2a - inescor2b)
inescor3diffa <- abs(inescor3a - inescor3b)
inescor4diffa <- abs(inescor4a - inescor4b)
inescor5diffa <- abs(inescor5a - inescor5b)
inescor6diffa <- abs(inescor6a - inescor6b)
inescor7diffa <- abs(inescor7a - inescor7b)
inescor8diffa <- abs(inescor8a - inescor8b)
inescor9diffa <- abs(inescor9a - inescor9b)
inescor10diffa <- abs(inescor10a - inescor10b)

inescor1diffb <- inescor1a - inescor1b
inescor2diffb <- inescor2a - inescor2b
inescor3diffb <- inescor3a - inescor3b
inescor4diffb <- inescor4a - inescor4b
inescor5diffb <- inescor5a - inescor5b
inescor6diffb <- inescor6a - inescor6b
inescor7diffb <- inescor7a - inescor7b
inescor8diffb <- inescor8a - inescor8b
inescor9diffb <- inescor9a - inescor9b
inescor10diffb <- inescor10a - inescor10b

inescordiff1 <- c(inescor1diffa, inescor2diffa, inescor3diffa, inescor4diffa, inescor5diffa, inescor6diffa, inescor7diffa, inescor8diffa, inescor9diffa, inescor10diffa)
inescordiff2 <- c(inescor1diffb, inescor2diffb, inescor3diffb, inescor4diffb, inescor5diffb, inescor6diffb, inescor7diffb, inescor8diffb, inescor9diffb, inescor10diffb)
inescordiffa1 <- sum(inescordiff1)/10
inescordiffb1 <- sum(inescordiff2)/10
inescor_max <- max(inescordiff1)

inescora2 <- c(inescor1a, inescor2a, inescor3a, inescor4a, inescor5a, inescor6a, inescor7a, inescor8a, inescor9a, inescor10a)

inescorb2 <- c(inescor1b, inescor2b, inescor3b, inescor4b, inescor5b, inescor6b, inescor7b, inescor8b, inescor9b, inescor10b)

inescoria <- (inescordiffa1)
inescorib <- (inescordiffb1)

#################
####SHP Panel####
#################

shpcor1a <- cor(shp$imm99[shp$all==0], shp$imm0[shp$all==0], method="spearman", use="pairwise")
shpcor2a <- cor(shp$imm99[shp$all==0], shp$imm1[shp$all==0], method="spearman", use="pairwise")
shpcor3a <- cor(shp$imm99[shp$all==0], shp$imm2[shp$all==0], method="spearman", use="pairwise")
shpcor4a <- cor(shp$imm99[shp$all==0], shp$imm3[shp$all==0], method="spearman", use="pairwise")
shpcor5a <- cor(shp$imm99[shp$all==0], shp$imm4[shp$all==0], method="spearman", use="pairwise")
shpcor6a <- cor(shp$imm99[shp$all==0], shp$imm5[shp$all==0], method="spearman", use="pairwise")
shpcor7a <- cor(shp$imm99[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor8a <- cor(shp$imm99[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor9a <- cor(shp$imm99[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor10a <- cor(shp$imm99[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor11a <- cor(shp$imm99[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor12a <- cor(shp$imm0[shp$all==0], shp$imm1[shp$all==0], method="spearman", use="pairwise")
shpcor13a <- cor(shp$imm0[shp$all==0], shp$imm2[shp$all==0], method="spearman", use="pairwise")
shpcor14a <- cor(shp$imm0[shp$all==0], shp$imm3[shp$all==0], method="spearman", use="pairwise")
shpcor15a <- cor(shp$imm0[shp$all==0], shp$imm4[shp$all==0], method="spearman", use="pairwise")
shpcor16a <- cor(shp$imm0[shp$all==0], shp$imm5[shp$all==0], method="spearman", use="pairwise")
shpcor17a <- cor(shp$imm0[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor18a <- cor(shp$imm0[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor19a <- cor(shp$imm0[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor20a <- cor(shp$imm0[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor21a <- cor(shp$imm0[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor22a <- cor(shp$imm1[shp$all==0], shp$imm2[shp$all==0], method="spearman", use="pairwise")
shpcor23a <- cor(shp$imm1[shp$all==0], shp$imm3[shp$all==0], method="spearman", use="pairwise")
shpcor24a <- cor(shp$imm1[shp$all==0], shp$imm4[shp$all==0], method="spearman", use="pairwise")
shpcor25a <- cor(shp$imm1[shp$all==0], shp$imm5[shp$all==0], method="spearman", use="pairwise")
shpcor26a <- cor(shp$imm1[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor27a <- cor(shp$imm1[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor28a <- cor(shp$imm1[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor29a <- cor(shp$imm1[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor30a <- cor(shp$imm1[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor31a <- cor(shp$imm2[shp$all==0], shp$imm3[shp$all==0], method="spearman", use="pairwise")
shpcor32a <- cor(shp$imm2[shp$all==0], shp$imm4[shp$all==0], method="spearman", use="pairwise")
shpcor33a <- cor(shp$imm2[shp$all==0], shp$imm5[shp$all==0], method="spearman", use="pairwise")
shpcor34a <- cor(shp$imm2[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor35a <- cor(shp$imm2[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor36a <- cor(shp$imm2[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor37a <- cor(shp$imm2[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor38a <- cor(shp$imm2[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor39a <- cor(shp$imm3[shp$all==0], shp$imm4[shp$all==0], method="spearman", use="pairwise")
shpcor40a <- cor(shp$imm3[shp$all==0], shp$imm5[shp$all==0], method="spearman", use="pairwise")
shpcor41a <- cor(shp$imm3[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor42a <- cor(shp$imm3[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor43a <- cor(shp$imm3[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor44a <- cor(shp$imm3[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor45a <- cor(shp$imm3[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor46a <- cor(shp$imm4[shp$all==0], shp$imm5[shp$all==0], method="spearman", use="pairwise")
shpcor47a <- cor(shp$imm4[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor48a <- cor(shp$imm4[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor49a <- cor(shp$imm4[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor50a <- cor(shp$imm4[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor51a <- cor(shp$imm4[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor52a <- cor(shp$imm5[shp$all==0], shp$imm6[shp$all==0], method="spearman", use="pairwise")
shpcor53a <- cor(shp$imm5[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor54a <- cor(shp$imm5[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor55a <- cor(shp$imm5[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor56a <- cor(shp$imm5[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor57a <- cor(shp$imm6[shp$all==0], shp$imm7[shp$all==0], method="spearman", use="pairwise")
shpcor58a <- cor(shp$imm6[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor59a <- cor(shp$imm6[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor60a <- cor(shp$imm6[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor61a <- cor(shp$imm7[shp$all==0], shp$imm8[shp$all==0], method="spearman", use="pairwise")
shpcor62a <- cor(shp$imm7[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor63a <- cor(shp$imm7[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor64a <- cor(shp$imm8[shp$all==0], shp$imm9[shp$all==0], method="spearman", use="pairwise")
shpcor65a <- cor(shp$imm8[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")
shpcor66a <- cor(shp$imm9[shp$all==0], shp$imm11[shp$all==0], method="spearman", use="pairwise")

shpcor1b <- cor(shp$imm99[shp$all==1], shp$imm0[shp$all==1], method="spearman", use="pairwise")
shpcor2b <- cor(shp$imm99[shp$all==1], shp$imm1[shp$all==1], method="spearman", use="pairwise")
shpcor3b <- cor(shp$imm99[shp$all==1], shp$imm2[shp$all==1], method="spearman", use="pairwise")
shpcor4b <- cor(shp$imm99[shp$all==1], shp$imm3[shp$all==1], method="spearman", use="pairwise")
shpcor5b <- cor(shp$imm99[shp$all==1], shp$imm4[shp$all==1], method="spearman", use="pairwise")
shpcor6b <- cor(shp$imm99[shp$all==1], shp$imm5[shp$all==1], method="spearman", use="pairwise")
shpcor7b <- cor(shp$imm99[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor8b <- cor(shp$imm99[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor9b <- cor(shp$imm99[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor10b <- cor(shp$imm99[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor11b <- cor(shp$imm99[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor12b <- cor(shp$imm0[shp$all==1], shp$imm1[shp$all==1], method="spearman", use="pairwise")
shpcor13b <- cor(shp$imm0[shp$all==1], shp$imm2[shp$all==1], method="spearman", use="pairwise")
shpcor14b <- cor(shp$imm0[shp$all==1], shp$imm3[shp$all==1], method="spearman", use="pairwise")
shpcor15b <- cor(shp$imm0[shp$all==1], shp$imm4[shp$all==1], method="spearman", use="pairwise")
shpcor16b <- cor(shp$imm0[shp$all==1], shp$imm5[shp$all==1], method="spearman", use="pairwise")
shpcor17b <- cor(shp$imm0[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor18b <- cor(shp$imm0[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor19b <- cor(shp$imm0[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor20b <- cor(shp$imm0[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor21b <- cor(shp$imm0[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor22b <- cor(shp$imm1[shp$all==1], shp$imm2[shp$all==1], method="spearman", use="pairwise")
shpcor23b <- cor(shp$imm1[shp$all==1], shp$imm3[shp$all==1], method="spearman", use="pairwise")
shpcor24b <- cor(shp$imm1[shp$all==1], shp$imm4[shp$all==1], method="spearman", use="pairwise")
shpcor25b <- cor(shp$imm1[shp$all==1], shp$imm5[shp$all==1], method="spearman", use="pairwise")
shpcor26b <- cor(shp$imm1[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor27b <- cor(shp$imm1[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor28b <- cor(shp$imm1[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor29b <- cor(shp$imm1[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor30b <- cor(shp$imm1[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor31b <- cor(shp$imm2[shp$all==1], shp$imm3[shp$all==1], method="spearman", use="pairwise")
shpcor32b <- cor(shp$imm2[shp$all==1], shp$imm4[shp$all==1], method="spearman", use="pairwise")
shpcor33b <- cor(shp$imm2[shp$all==1], shp$imm5[shp$all==1], method="spearman", use="pairwise")
shpcor34b <- cor(shp$imm2[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor35b <- cor(shp$imm2[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor36b <- cor(shp$imm2[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor37b <- cor(shp$imm2[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor38b <- cor(shp$imm2[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor39b <- cor(shp$imm3[shp$all==1], shp$imm4[shp$all==1], method="spearman", use="pairwise")
shpcor40b <- cor(shp$imm3[shp$all==1], shp$imm5[shp$all==1], method="spearman", use="pairwise")
shpcor41b <- cor(shp$imm3[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor42b <- cor(shp$imm3[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor43b <- cor(shp$imm3[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor44b <- cor(shp$imm3[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor45b <- cor(shp$imm3[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor46b <- cor(shp$imm4[shp$all==1], shp$imm5[shp$all==1], method="spearman", use="pairwise")
shpcor47b <- cor(shp$imm4[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor48b <- cor(shp$imm4[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor49b <- cor(shp$imm4[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor50b <- cor(shp$imm4[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor51b <- cor(shp$imm4[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor52b <- cor(shp$imm5[shp$all==1], shp$imm6[shp$all==1], method="spearman", use="pairwise")
shpcor53b <- cor(shp$imm5[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor54b <- cor(shp$imm5[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor55b <- cor(shp$imm5[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor56b <- cor(shp$imm5[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor57b <- cor(shp$imm6[shp$all==1], shp$imm7[shp$all==1], method="spearman", use="pairwise")
shpcor58b <- cor(shp$imm6[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor59b <- cor(shp$imm6[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor60b <- cor(shp$imm6[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor61b <- cor(shp$imm7[shp$all==1], shp$imm8[shp$all==1], method="spearman", use="pairwise")
shpcor62b <- cor(shp$imm7[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor63b <- cor(shp$imm7[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor64b <- cor(shp$imm8[shp$all==1], shp$imm9[shp$all==1], method="spearman", use="pairwise")
shpcor65b <- cor(shp$imm8[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")
shpcor66b <- cor(shp$imm9[shp$all==1], shp$imm11[shp$all==1], method="spearman", use="pairwise")

shpcor1diffa <- abs(shpcor1a - shpcor1b)
shpcor2diffa <- abs(shpcor2a - shpcor2b)
shpcor3diffa <- abs(shpcor3a - shpcor3b)
shpcor4diffa <- abs(shpcor4a - shpcor4b)
shpcor5diffa <- abs(shpcor5a - shpcor5b)
shpcor6diffa <- abs(shpcor6a - shpcor6b)
shpcor7diffa <- abs(shpcor7a - shpcor7b)
shpcor8diffa <- abs(shpcor8a - shpcor8b)
shpcor9diffa <- abs(shpcor9a - shpcor9b)
shpcor10diffa <- abs(shpcor10a - shpcor10b)
shpcor11diffa <- abs(shpcor11a - shpcor11b)
shpcor12diffa <- abs(shpcor12a - shpcor12b)
shpcor13diffa <- abs(shpcor13a - shpcor13b)
shpcor14diffa <- abs(shpcor14a - shpcor14b)
shpcor15diffa <- abs(shpcor15a - shpcor15b)
shpcor16diffa <- abs(shpcor16a - shpcor16b)
shpcor17diffa <- abs(shpcor17a - shpcor17b)
shpcor18diffa <- abs(shpcor18a - shpcor18b)
shpcor19diffa <- abs(shpcor19a - shpcor19b)
shpcor20diffa <- abs(shpcor20a - shpcor20b)
shpcor21diffa <- abs(shpcor21a - shpcor21b)
shpcor22diffa <- abs(shpcor22a - shpcor22b)
shpcor23diffa <- abs(shpcor23a - shpcor23b)
shpcor24diffa <- abs(shpcor24a - shpcor24b)
shpcor25diffa <- abs(shpcor25a - shpcor25b)
shpcor26diffa <- abs(shpcor26a - shpcor26b)
shpcor27diffa <- abs(shpcor27a - shpcor27b)
shpcor28diffa <- abs(shpcor28a - shpcor28b)
shpcor29diffa <- abs(shpcor29a - shpcor29b)
shpcor30diffa <- abs(shpcor30a - shpcor30b)
shpcor31diffa <- abs(shpcor31a - shpcor31b)
shpcor32diffa <- abs(shpcor32a - shpcor32b)
shpcor33diffa <- abs(shpcor33a - shpcor33b)
shpcor34diffa <- abs(shpcor34a - shpcor34b)
shpcor35diffa <- abs(shpcor35a - shpcor35b)
shpcor36diffa <- abs(shpcor36a - shpcor36b)
shpcor37diffa <- abs(shpcor37a - shpcor37b)
shpcor38diffa <- abs(shpcor38a - shpcor38b)
shpcor39diffa <- abs(shpcor39a - shpcor39b)
shpcor40diffa <- abs(shpcor40a - shpcor40b)
shpcor41diffa <- abs(shpcor41a - shpcor41b)
shpcor42diffa <- abs(shpcor42a - shpcor42b)
shpcor43diffa <- abs(shpcor43a - shpcor43b)
shpcor44diffa <- abs(shpcor44a - shpcor44b)
shpcor45diffa <- abs(shpcor45a - shpcor45b)
shpcor46diffa <- abs(shpcor46a - shpcor46b)
shpcor47diffa <- abs(shpcor47a - shpcor47b)
shpcor48diffa <- abs(shpcor48a - shpcor48b)
shpcor49diffa <- abs(shpcor49a - shpcor49b)
shpcor50diffa <- abs(shpcor50a - shpcor50b)
shpcor51diffa <- abs(shpcor51a - shpcor51b)
shpcor52diffa <- abs(shpcor52a - shpcor52b)
shpcor53diffa <- abs(shpcor53a - shpcor53b)
shpcor54diffa <- abs(shpcor54a - shpcor54b)
shpcor55diffa <- abs(shpcor55a - shpcor55b)
shpcor56diffa <- abs(shpcor56a - shpcor56b)
shpcor57diffa <- abs(shpcor57a - shpcor57b)
shpcor58diffa <- abs(shpcor58a - shpcor58b)
shpcor59diffa <- abs(shpcor59a - shpcor59b)
shpcor60diffa <- abs(shpcor60a - shpcor60b)
shpcor61diffa <- abs(shpcor61a - shpcor61b)
shpcor62diffa <- abs(shpcor62a - shpcor62b)
shpcor63diffa <- abs(shpcor63a - shpcor63b)
shpcor64diffa <- abs(shpcor64a - shpcor64b)
shpcor65diffa <- abs(shpcor65a - shpcor65b)
shpcor66diffa <- abs(shpcor66a - shpcor66b)

shpcor1diffb <- shpcor1a - shpcor1b
shpcor2diffb <- shpcor2a - shpcor2b
shpcor3diffb <- shpcor3a - shpcor3b
shpcor4diffb <- shpcor4a - shpcor4b
shpcor5diffb <- shpcor5a - shpcor5b
shpcor6diffb <- shpcor6a - shpcor6b
shpcor7diffb <- shpcor7a - shpcor7b
shpcor8diffb <- shpcor8a - shpcor8b
shpcor9diffb <- shpcor9a - shpcor9b
shpcor10diffb <- shpcor10a - shpcor10b
shpcor11diffb <- shpcor11a - shpcor11b
shpcor12diffb <- shpcor12a - shpcor12b
shpcor13diffb <- shpcor13a - shpcor13b
shpcor14diffb <- shpcor14a - shpcor14b
shpcor15diffb <- shpcor15a - shpcor15b
shpcor16diffb <- shpcor16a - shpcor16b
shpcor17diffb <- shpcor17a - shpcor17b
shpcor18diffb <- shpcor18a - shpcor18b
shpcor19diffb <- shpcor19a - shpcor19b
shpcor20diffb <- shpcor20a - shpcor20b
shpcor21diffb <- shpcor21a - shpcor21b
shpcor22diffb <- shpcor22a - shpcor22b
shpcor23diffb <- shpcor23a - shpcor23b
shpcor24diffb <- shpcor24a - shpcor24b
shpcor25diffb <- shpcor25a - shpcor25b
shpcor26diffb <- shpcor26a - shpcor26b
shpcor27diffb <- shpcor27a - shpcor27b
shpcor28diffb <- shpcor28a - shpcor28b
shpcor29diffb <- shpcor29a - shpcor29b
shpcor30diffb <- shpcor30a - shpcor30b
shpcor31diffb <- shpcor31a - shpcor31b
shpcor32diffb <- shpcor32a - shpcor32b
shpcor33diffb <- shpcor33a - shpcor33b
shpcor34diffb <- shpcor34a - shpcor34b
shpcor35diffb <- shpcor35a - shpcor35b
shpcor36diffb <- shpcor36a - shpcor36b
shpcor37diffb <- shpcor37a - shpcor37b
shpcor38diffb <- shpcor38a - shpcor38b
shpcor39diffb <- shpcor39a - shpcor39b
shpcor40diffb <- shpcor40a - shpcor40b
shpcor41diffb <- shpcor41a - shpcor41b
shpcor42diffb <- shpcor42a - shpcor42b
shpcor43diffb <- shpcor43a - shpcor43b
shpcor44diffb <- shpcor44a - shpcor44b
shpcor45diffb <- shpcor45a - shpcor45b
shpcor46diffb <- shpcor46a - shpcor46b
shpcor47diffb <- shpcor47a - shpcor47b
shpcor48diffb <- shpcor48a - shpcor48b
shpcor49diffb <- shpcor49a - shpcor49b
shpcor50diffb <- shpcor50a - shpcor50b
shpcor51diffb <- shpcor51a - shpcor51b
shpcor52diffb <- shpcor52a - shpcor52b
shpcor53diffb <- shpcor53a - shpcor53b
shpcor54diffb <- shpcor54a - shpcor54b
shpcor55diffb <- shpcor55a - shpcor55b
shpcor56diffb <- shpcor56a - shpcor56b
shpcor57diffb <- shpcor57a - shpcor57b
shpcor58diffb <- shpcor58a - shpcor58b
shpcor59diffb <- shpcor59a - shpcor59b
shpcor60diffb <- shpcor60a - shpcor60b
shpcor61diffb <- shpcor61a - shpcor61b
shpcor62diffb <- shpcor62a - shpcor62b
shpcor63diffb <- shpcor63a - shpcor63b
shpcor64diffb <- shpcor64a - shpcor64b
shpcor65diffb <- shpcor65a - shpcor65b
shpcor66diffb <- shpcor66a - shpcor66b

shpcordiff1 <- c(shpcor1diffa, shpcor2diffa, shpcor3diffa, shpcor4diffa, shpcor5diffa, shpcor6diffa, shpcor7diffa, shpcor8diffa, shpcor9diffa, shpcor10diffa, shpcor11diffa, shpcor12diffa, shpcor13diffa, shpcor14diffa, shpcor15diffa, shpcor16diffa, shpcor17diffa, shpcor18diffa, shpcor19diffa, shpcor20diffa, shpcor21diffa, shpcor22diffa, shpcor23diffa, shpcor24diffa, shpcor25diffa, shpcor26diffa, shpcor27diffa, shpcor28diffa, shpcor29diffa, shpcor30diffa, shpcor31diffa, shpcor32diffa, shpcor33diffa, shpcor34diffa, shpcor35diffa, shpcor36diffa, shpcor37diffa, shpcor38diffa, shpcor39diffa, shpcor40diffa, shpcor41diffa, shpcor42diffa, shpcor43diffa, shpcor44diffa, shpcor45diffa, shpcor46diffa, shpcor47diffa, shpcor48diffa, shpcor49diffa, shpcor50diffa, shpcor51diffa, shpcor52diffa, shpcor53diffa, shpcor54diffa, shpcor55diffa, shpcor56diffa, shpcor57diffa, shpcor58diffa, shpcor59diffa, shpcor60diffa, shpcor61diffa, shpcor62diffa, shpcor63diffa, shpcor64diffa, shpcor65diffa, shpcor66diffa)

shpcordiff2 <- c(shpcor1diffb, shpcor2diffb, shpcor3diffb, shpcor4diffb, shpcor5diffb, shpcor6diffb, shpcor7diffb, shpcor8diffb, shpcor9diffb, shpcor10diffb, shpcor11diffb, shpcor12diffb, shpcor13diffb, shpcor14diffb, shpcor15diffb, shpcor16diffb, shpcor17diffb, shpcor18diffb, shpcor19diffb, shpcor20diffb, shpcor21diffb, shpcor22diffb, shpcor23diffb, shpcor24diffb, shpcor25diffb, shpcor26diffb, shpcor27diffb, shpcor28diffb, shpcor29diffb, shpcor30diffb, shpcor31diffb, shpcor32diffb, shpcor33diffb, shpcor34diffb, shpcor35diffb, shpcor36diffb, shpcor37diffb, shpcor38diffb, shpcor39diffb, shpcor40diffb, shpcor41diffb, shpcor42diffb, shpcor43diffb, shpcor44diffb, shpcor45diffb, shpcor46diffb, shpcor47diffb, shpcor48diffb, shpcor49diffb, shpcor50diffb, shpcor51diffb, shpcor52diffb, shpcor53diffb, shpcor54diffb, shpcor55diffb, shpcor56diffb, shpcor57diffb, shpcor58diffb, shpcor59diffb, shpcor60diffb, shpcor61diffb, shpcor62diffb, shpcor63diffb, shpcor64diffb, shpcor65diffb, shpcor66diffb)

shpcordiffa1 <- sum(shpcordiff1)/66
shpcordiffb1 <- sum(shpcordiff2)/66
shpcor_max <- max(shpcordiff1)

shpcora1 <- c(shpcor1a, shpcor2a, shpcor3a, shpcor4a, shpcor5a, shpcor6a, shpcor7a, shpcor8a, shpcor9a, shpcor10a, shpcor11a, shpcor12a, shpcor13a, shpcor14a, shpcor15a, shpcor16a, shpcor17a, shpcor18a, shpcor19a, shpcor20a, shpcor21a, shpcor22a, shpcor23a, shpcor24a, shpcor25a, shpcor26a, shpcor27a, shpcor28a, shpcor29a, shpcor30a, shpcor31a, shpcor32a, shpcor33a, shpcor34a, shpcor35a, shpcor36a, shpcor37a, shpcor38a, shpcor39a, shpcor40a, shpcor41a, shpcor42a, shpcor43a, shpcor44a, shpcor45a, shpcor46a, shpcor47a, shpcor48a, shpcor49a, shpcor50a, shpcor51a, shpcor52a, shpcor53a, shpcor54a, shpcor55a, shpcor56a, shpcor57a, shpcor58a, shpcor59a, shpcor60a, shpcor61a, shpcor62a, shpcor63a, shpcor64a, shpcor65a, shpcor66a)

shpcorb1 <- c(shpcor1b, shpcor2b, shpcor3b, shpcor4b, shpcor5b, shpcor6b, shpcor7b, shpcor8b, shpcor9b, shpcor10b, shpcor11b, shpcor12b, shpcor13b, shpcor14b, shpcor15b, shpcor16b, shpcor17b, shpcor18b, shpcor19b, shpcor20b, shpcor21b, shpcor22b, shpcor23b, shpcor24b, shpcor25b, shpcor26b, shpcor27b, shpcor28b, shpcor29b, shpcor30b, shpcor31b, shpcor32b, shpcor33b, shpcor34b, shpcor35b, shpcor36b, shpcor37b, shpcor38b, shpcor39b, shpcor40b, shpcor41b, shpcor42b, shpcor43b, shpcor44b, shpcor45b, shpcor46b, shpcor47b, shpcor48b, shpcor49b, shpcor50b, shpcor51b, shpcor52b, shpcor53b, shpcor54b, shpcor55b, shpcor56b, shpcor57b, shpcor58b, shpcor59b, shpcor60b, shpcor61b, shpcor62b, shpcor63b, shpcor64b, shpcor65b, shpcor66b)

shpcoria <- (shpcordiffa1)
shpcorib <- (shpcordiffb1)

##################
####GLES Panel####
##################

glescor1a <- cor(gles$imm1[gles$all==0], gles$imm2[gles$all==0], method="spearman", use="pairwise")
glescor2a <- cor(gles$imm1[gles$all==0], gles$imm4[gles$all==0], method="spearman", use="pairwise")
glescor3a <- cor(gles$imm1[gles$all==0], gles$imm6[gles$all==0], method="spearman", use="pairwise")
glescor4a <- cor(gles$imm1[gles$all==0], gles$imm10[gles$all==0], method="spearman", use="pairwise")
glescor5a <- cor(gles$imm1[gles$all==0], gles$imm11[gles$all==0], method="spearman", use="pairwise")
glescor6a <- cor(gles$imm1[gles$all==0], gles$imm12[gles$all==0], method="spearman", use="pairwise")
glescor7a <- cor(gles$imm1[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor8a <- cor(gles$imm1[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor9a <- cor(gles$imm1[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor10a <- cor(gles$imm2[gles$all==0], gles$imm4[gles$all==0], method="spearman", use="pairwise")
glescor11a <- cor(gles$imm2[gles$all==0], gles$imm6[gles$all==0], method="spearman", use="pairwise")
glescor12a <- cor(gles$imm2[gles$all==0], gles$imm10[gles$all==0], method="spearman", use="pairwise")
glescor13a <- cor(gles$imm2[gles$all==0], gles$imm11[gles$all==0], method="spearman", use="pairwise")
glescor14a <- cor(gles$imm2[gles$all==0], gles$imm12[gles$all==0], method="spearman", use="pairwise")
glescor15a <- cor(gles$imm2[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor16a <- cor(gles$imm2[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor17a <- cor(gles$imm2[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor18a <- cor(gles$imm4[gles$all==0], gles$imm6[gles$all==0], method="spearman", use="pairwise")
glescor19a <- cor(gles$imm4[gles$all==0], gles$imm10[gles$all==0], method="spearman", use="pairwise")
glescor20a <- cor(gles$imm4[gles$all==0], gles$imm11[gles$all==0], method="spearman", use="pairwise")
glescor21a <- cor(gles$imm4[gles$all==0], gles$imm12[gles$all==0], method="spearman", use="pairwise")
glescor22a <- cor(gles$imm4[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor23a <- cor(gles$imm4[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor24a <- cor(gles$imm4[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor25a <- cor(gles$imm6[gles$all==0], gles$imm10[gles$all==0], method="spearman", use="pairwise")
glescor26a <- cor(gles$imm6[gles$all==0], gles$imm11[gles$all==0], method="spearman", use="pairwise")
glescor27a <- cor(gles$imm6[gles$all==0], gles$imm12[gles$all==0], method="spearman", use="pairwise")
glescor28a <- cor(gles$imm6[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor29a <- cor(gles$imm6[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor30a <- cor(gles$imm6[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor31a <- cor(gles$imm10[gles$all==0], gles$imm11[gles$all==0], method="spearman", use="pairwise")
glescor32a <- cor(gles$imm10[gles$all==0], gles$imm12[gles$all==0], method="spearman", use="pairwise")
glescor33a <- cor(gles$imm10[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor34a <- cor(gles$imm10[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor35a <- cor(gles$imm10[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor36a <- cor(gles$imm11[gles$all==0], gles$imm12[gles$all==0], method="spearman", use="pairwise")
glescor37a <- cor(gles$imm11[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor38a <- cor(gles$imm11[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor39a <- cor(gles$imm11[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor40a <- cor(gles$imm12[gles$all==0], gles$imm13[gles$all==0], method="spearman", use="pairwise")
glescor41a <- cor(gles$imm12[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor42a <- cor(gles$imm12[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor43a <- cor(gles$imm13[gles$all==0], gles$imm15[gles$all==0], method="spearman", use="pairwise")
glescor44a <- cor(gles$imm13[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")
glescor45a <- cor(gles$imm15[gles$all==0], gles$imm17[gles$all==0], method="spearman", use="pairwise")

glescor1b <- cor(gles$imm1[gles$all==1], gles$imm2[gles$all==1], method="spearman", use="pairwise")
glescor2b <- cor(gles$imm1[gles$all==1], gles$imm4[gles$all==1], method="spearman", use="pairwise")
glescor3b <- cor(gles$imm1[gles$all==1], gles$imm6[gles$all==1], method="spearman", use="pairwise")
glescor4b <- cor(gles$imm1[gles$all==1], gles$imm10[gles$all==1], method="spearman", use="pairwise")
glescor5b <- cor(gles$imm1[gles$all==1], gles$imm11[gles$all==1], method="spearman", use="pairwise")
glescor6b <- cor(gles$imm1[gles$all==1], gles$imm12[gles$all==1], method="spearman", use="pairwise")
glescor7b <- cor(gles$imm1[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor8b <- cor(gles$imm1[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor9b <- cor(gles$imm1[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor10b <- cor(gles$imm2[gles$all==1], gles$imm4[gles$all==1], method="spearman", use="pairwise")
glescor11b <- cor(gles$imm2[gles$all==1], gles$imm6[gles$all==1], method="spearman", use="pairwise")
glescor12b <- cor(gles$imm2[gles$all==1], gles$imm10[gles$all==1], method="spearman", use="pairwise")
glescor13b <- cor(gles$imm2[gles$all==1], gles$imm11[gles$all==1], method="spearman", use="pairwise")
glescor14b <- cor(gles$imm2[gles$all==1], gles$imm12[gles$all==1], method="spearman", use="pairwise")
glescor15b <- cor(gles$imm2[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor16b <- cor(gles$imm2[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor17b <- cor(gles$imm2[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor18b <- cor(gles$imm4[gles$all==1], gles$imm6[gles$all==1], method="spearman", use="pairwise")
glescor19b <- cor(gles$imm4[gles$all==1], gles$imm10[gles$all==1], method="spearman", use="pairwise")
glescor20b <- cor(gles$imm4[gles$all==1], gles$imm11[gles$all==1], method="spearman", use="pairwise")
glescor21b <- cor(gles$imm4[gles$all==1], gles$imm12[gles$all==1], method="spearman", use="pairwise")
glescor22b <- cor(gles$imm4[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor23b <- cor(gles$imm4[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor24b <- cor(gles$imm4[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor25b <- cor(gles$imm6[gles$all==1], gles$imm10[gles$all==1], method="spearman", use="pairwise")
glescor26b <- cor(gles$imm6[gles$all==1], gles$imm11[gles$all==1], method="spearman", use="pairwise")
glescor27b <- cor(gles$imm6[gles$all==1], gles$imm12[gles$all==1], method="spearman", use="pairwise")
glescor28b <- cor(gles$imm6[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor29b <- cor(gles$imm6[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor30b <- cor(gles$imm6[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor31b <- cor(gles$imm10[gles$all==1], gles$imm11[gles$all==1], method="spearman", use="pairwise")
glescor32b <- cor(gles$imm10[gles$all==1], gles$imm12[gles$all==1], method="spearman", use="pairwise")
glescor33b <- cor(gles$imm10[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor34b <- cor(gles$imm10[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor35b <- cor(gles$imm10[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor36b <- cor(gles$imm11[gles$all==1], gles$imm12[gles$all==1], method="spearman", use="pairwise")
glescor37b <- cor(gles$imm11[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor38b <- cor(gles$imm11[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor39b <- cor(gles$imm11[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor40b <- cor(gles$imm12[gles$all==1], gles$imm13[gles$all==1], method="spearman", use="pairwise")
glescor41b <- cor(gles$imm12[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor42b <- cor(gles$imm12[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor43b <- cor(gles$imm13[gles$all==1], gles$imm15[gles$all==1], method="spearman", use="pairwise")
glescor44b <- cor(gles$imm13[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")
glescor45b <- cor(gles$imm15[gles$all==1], gles$imm17[gles$all==1], method="spearman", use="pairwise")

glescor1diffa <- abs(glescor1a - glescor1b)
glescor2diffa <- abs(glescor2a - glescor2b)
glescor3diffa <- abs(glescor3a - glescor3b)
glescor4diffa <- abs(glescor4a - glescor4b)
glescor5diffa <- abs(glescor5a - glescor5b)
glescor6diffa <- abs(glescor6a - glescor6b)
glescor7diffa <- abs(glescor7a - glescor7b)
glescor8diffa <- abs(glescor8a - glescor8b)
glescor9diffa <- abs(glescor9a - glescor9b)
glescor10diffa <- abs(glescor10a - glescor10b)
glescor11diffa <- abs(glescor11a - glescor11b)
glescor12diffa <- abs(glescor12a - glescor12b)
glescor13diffa <- abs(glescor13a - glescor13b)
glescor14diffa <- abs(glescor14a - glescor14b)
glescor15diffa <- abs(glescor15a - glescor15b)
glescor16diffa <- abs(glescor16a - glescor16b)
glescor17diffa <- abs(glescor17a - glescor17b)
glescor18diffa <- abs(glescor18a - glescor18b)
glescor19diffa <- abs(glescor19a - glescor19b)
glescor20diffa <- abs(glescor20a - glescor20b)
glescor21diffa <- abs(glescor21a - glescor21b)
glescor22diffa <- abs(glescor22a - glescor22b)
glescor23diffa <- abs(glescor23a - glescor23b)
glescor24diffa <- abs(glescor24a - glescor24b)
glescor25diffa <- abs(glescor25a - glescor25b)
glescor26diffa <- abs(glescor26a - glescor26b)
glescor27diffa <- abs(glescor27a - glescor27b)
glescor28diffa <- abs(glescor28a - glescor28b)
glescor29diffa <- abs(glescor29a - glescor29b)
glescor30diffa <- abs(glescor30a - glescor30b)
glescor31diffa <- abs(glescor31a - glescor31b)
glescor32diffa <- abs(glescor32a - glescor32b)
glescor33diffa <- abs(glescor33a - glescor33b)
glescor34diffa <- abs(glescor34a - glescor34b)
glescor35diffa <- abs(glescor35a - glescor35b)
glescor36diffa <- abs(glescor36a - glescor36b)
glescor37diffa <- abs(glescor37a - glescor37b)
glescor38diffa <- abs(glescor38a - glescor38b)
glescor39diffa <- abs(glescor39a - glescor39b)
glescor40diffa <- abs(glescor40a - glescor40b)
glescor41diffa <- abs(glescor41a - glescor41b)
glescor42diffa <- abs(glescor42a - glescor42b)
glescor43diffa <- abs(glescor43a - glescor43b)
glescor44diffa <- abs(glescor44a - glescor44b)
glescor45diffa <- abs(glescor45a - glescor45b)

glescor1diffb <- glescor1a - glescor1b
glescor2diffb <- glescor2a - glescor2b
glescor3diffb <- glescor3a - glescor3b
glescor4diffb <- glescor4a - glescor4b
glescor5diffb <- glescor5a - glescor5b
glescor6diffb <- glescor6a - glescor6b
glescor7diffb <- glescor7a - glescor7b
glescor8diffb <- glescor8a - glescor8b
glescor9diffb <- glescor9a - glescor9b
glescor10diffb <- glescor10a - glescor10b
glescor11diffb <- glescor11a - glescor11b
glescor12diffb <- glescor12a - glescor12b
glescor13diffb <- glescor13a - glescor13b
glescor14diffb <- glescor14a - glescor14b
glescor15diffb <- glescor15a - glescor15b
glescor16diffb <- glescor16a - glescor16b
glescor17diffb <- glescor17a - glescor17b
glescor18diffb <- glescor18a - glescor18b
glescor19diffb <- glescor19a - glescor19b
glescor20diffb <- glescor20a - glescor20b
glescor21diffb <- glescor21a - glescor21b
glescor22diffb <- glescor22a - glescor22b
glescor23diffb <- glescor23a - glescor23b
glescor24diffb <- glescor24a - glescor24b
glescor25diffb <- glescor25a - glescor25b
glescor26diffb <- glescor26a - glescor26b
glescor27diffb <- glescor27a - glescor27b
glescor28diffb <- glescor28a - glescor28b
glescor29diffb <- glescor29a - glescor29b
glescor30diffb <- glescor30a - glescor30b
glescor31diffb <- glescor31a - glescor31b
glescor32diffb <- glescor32a - glescor32b
glescor33diffb <- glescor33a - glescor33b
glescor34diffb <- glescor34a - glescor34b
glescor35diffb <- glescor35a - glescor35b
glescor36diffb <- glescor36a - glescor36b
glescor37diffb <- glescor37a - glescor37b
glescor38diffb <- glescor38a - glescor38b
glescor39diffb <- glescor39a - glescor39b
glescor40diffb <- glescor40a - glescor40b
glescor41diffb <- glescor41a - glescor41b
glescor42diffb <- glescor42a - glescor42b
glescor43diffb <- glescor43a - glescor43b
glescor44diffb <- glescor44a - glescor44b
glescor45diffb <- glescor45a - glescor45b

glescordiff1 <- c(glescor1diffa, glescor2diffa, glescor3diffa, glescor4diffa, glescor5diffa, glescor6diffa, glescor7diffa, glescor8diffa, glescor9diffa, glescor10diffa, glescor11diffa, glescor12diffa, glescor13diffa, glescor14diffa, glescor15diffa, glescor16diffa, glescor17diffa, glescor18diffa, glescor19diffa, glescor20diffa, glescor21diffa, glescor22diffa, glescor23diffa, glescor24diffa, glescor25diffa, glescor26diffa, glescor27diffa, glescor28diffa, glescor29diffa, glescor30diffa, glescor31diffa, glescor32diffa, glescor33diffa, glescor34diffa, glescor35diffa, glescor36diffa, glescor37diffa, glescor38diffa, glescor39diffa, glescor40diffa, glescor41diffa, glescor42diffa, glescor43diffa, glescor44diffa, glescor45diffa)

glescordiff2 <- c(glescor1diffb, glescor2diffb, glescor3diffb, glescor4diffb, glescor5diffb, glescor6diffb, glescor7diffb, glescor8diffb, glescor9diffb, glescor10diffb, glescor11diffb, glescor12diffb, glescor13diffb, glescor14diffb, glescor15diffb, glescor16diffb, glescor17diffb, glescor18diffb, glescor19diffb, glescor20diffb, glescor21diffb, glescor22diffb, glescor23diffb, glescor24diffb, glescor25diffb, glescor26diffb, glescor27diffb, glescor28diffb, glescor29diffb, glescor30diffb, glescor31diffb, glescor32diffb, glescor33diffb, glescor34diffb, glescor35diffb, glescor36diffb, glescor37diffb, glescor38diffb, glescor39diffb, glescor40diffb, glescor41diffb, glescor42diffb, glescor43diffb, glescor44diffb, glescor45diffb)

glescordiffa1 <- sum(glescordiff1)/45
glescordiffb1 <- sum(glescordiff2)/45
glescor_max <- max(glescordiff1)

glescora1 <- c(glescor1a, glescor2a, glescor3a, glescor4a, glescor5a, glescor6a, glescor7a, glescor8a, glescor9a, glescor10a, glescor11a, glescor12a, glescor13a, glescor14a, glescor15a, glescor16a, glescor17a, glescor18a, glescor19a, glescor20a, glescor21a, glescor22a, glescor23a, glescor24a, glescor25a, glescor26a, glescor27a, glescor28a, glescor29a, glescor30a, glescor31a, glescor32a, glescor33a, glescor34a, glescor35a, glescor36a, glescor37a, glescor38a, glescor39a, glescor40a, glescor41a, glescor42a, glescor43a, glescor44a, glescor45a)

glescorb1 <- c(glescor1b, glescor2b, glescor3b, glescor4b, glescor5b, glescor6b, glescor7b, glescor8b, glescor9b, glescor10b, glescor11b, glescor12b, glescor13b, glescor14b, glescor15b, glescor16b, glescor17b, glescor18b, glescor19b, glescor20b, glescor21b, glescor22b, glescor23b, glescor24b, glescor25b, glescor26b, glescor27b, glescor28b, glescor29b, glescor30b, glescor31b, glescor32b, glescor33b, glescor34b, glescor35b, glescor36b, glescor37b, glescor38b, glescor39b, glescor40b, glescor41b, glescor42b, glescor43b, glescor44b, glescor45b)

glescoria <- (glescordiffa1)
glescorib <- (glescordiffb1)

##################
####TAPS Panel####
##################

tapscor1a <- cor(taps$imm8[taps$all==0], taps$imm15[taps$all==0], method="spearman", use="pairwise")
tapscor2a <- cor(taps$imm8[taps$all==0], taps$imm22[taps$all==0], method="spearman", use="pairwise")
tapscor3a <- cor(taps$imm8[taps$all==0], taps$imm27[taps$all==0], method="spearman", use="pairwise")
tapscor4a <- cor(taps$imm8[taps$all==0], taps$imm34[taps$all==0], method="spearman", use="pairwise")
tapscor5a <- cor(taps$imm8[taps$all==0], taps$imm37[taps$all==0], method="spearman", use="pairwise")
tapscor6a <- cor(taps$imm8[taps$all==0], taps$imm46[taps$all==0], method="spearman", use="pairwise")
tapscor7a <- cor(taps$imm8[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor8a <- cor(taps$imm8[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor9a <- cor(taps$imm8[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor10a <- cor(taps$imm8[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor11a <- cor(taps$imm15[taps$all==0], taps$imm22[taps$all==0], method="spearman", use="pairwise")
tapscor12a <- cor(taps$imm15[taps$all==0], taps$imm27[taps$all==0], method="spearman", use="pairwise")
tapscor13a <- cor(taps$imm15[taps$all==0], taps$imm34[taps$all==0], method="spearman", use="pairwise")
tapscor14a <- cor(taps$imm15[taps$all==0], taps$imm37[taps$all==0], method="spearman", use="pairwise")
tapscor15a <- cor(taps$imm15[taps$all==0], taps$imm46[taps$all==0], method="spearman", use="pairwise")
tapscor16a <- cor(taps$imm15[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor17a <- cor(taps$imm15[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor18a <- cor(taps$imm15[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor19a <- cor(taps$imm15[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor20a <- cor(taps$imm22[taps$all==0], taps$imm27[taps$all==0], method="spearman", use="pairwise")
tapscor21a <- cor(taps$imm22[taps$all==0], taps$imm34[taps$all==0], method="spearman", use="pairwise")
tapscor22a <- cor(taps$imm22[taps$all==0], taps$imm37[taps$all==0], method="spearman", use="pairwise")
tapscor23a <- cor(taps$imm22[taps$all==0], taps$imm46[taps$all==0], method="spearman", use="pairwise")
tapscor24a <- cor(taps$imm22[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor25a <- cor(taps$imm22[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor26a <- cor(taps$imm22[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor27a <- cor(taps$imm22[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor28a <- cor(taps$imm27[taps$all==0], taps$imm34[taps$all==0], method="spearman", use="pairwise")
tapscor29a <- cor(taps$imm27[taps$all==0], taps$imm37[taps$all==0], method="spearman", use="pairwise")
tapscor30a <- cor(taps$imm27[taps$all==0], taps$imm46[taps$all==0], method="spearman", use="pairwise")
tapscor31a <- cor(taps$imm27[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor32a <- cor(taps$imm27[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor33a <- cor(taps$imm27[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor34a <- cor(taps$imm27[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor35a <- cor(taps$imm34[taps$all==0], taps$imm37[taps$all==0], method="spearman", use="pairwise")
tapscor36a <- cor(taps$imm34[taps$all==0], taps$imm46[taps$all==0], method="spearman", use="pairwise")
tapscor37a <- cor(taps$imm34[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor38a <- cor(taps$imm34[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor39a <- cor(taps$imm34[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor40a <- cor(taps$imm34[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor41a <- cor(taps$imm37[taps$all==0], taps$imm46[taps$all==0], method="spearman", use="pairwise")
tapscor42a <- cor(taps$imm37[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor43a <- cor(taps$imm37[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor44a <- cor(taps$imm37[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor45a <- cor(taps$imm37[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor46a <- cor(taps$imm46[taps$all==0], taps$imm49[taps$all==0], method="spearman", use="pairwise")
tapscor47a <- cor(taps$imm46[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor48a <- cor(taps$imm46[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor49a <- cor(taps$imm46[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor50a <- cor(taps$imm49[taps$all==0], taps$imm51[taps$all==0], method="spearman", use="pairwise")
tapscor51a <- cor(taps$imm49[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor52a <- cor(taps$imm49[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor53a <- cor(taps$imm51[taps$all==0], taps$imm54[taps$all==0], method="spearman", use="pairwise")
tapscor54a <- cor(taps$imm51[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")
tapscor55a <- cor(taps$imm54[taps$all==0], taps$imm56[taps$all==0], method="spearman", use="pairwise")

tapscor1b <- cor(taps$imm8[taps$all==1], taps$imm15[taps$all==1], method="spearman", use="pairwise")
tapscor2b <- cor(taps$imm8[taps$all==1], taps$imm22[taps$all==1], method="spearman", use="pairwise")
tapscor3b <- cor(taps$imm8[taps$all==1], taps$imm27[taps$all==1], method="spearman", use="pairwise")
tapscor4b <- cor(taps$imm8[taps$all==1], taps$imm34[taps$all==1], method="spearman", use="pairwise")
tapscor5b <- cor(taps$imm8[taps$all==1], taps$imm37[taps$all==1], method="spearman", use="pairwise")
tapscor6b <- cor(taps$imm8[taps$all==1], taps$imm46[taps$all==1], method="spearman", use="pairwise")
tapscor7b <- cor(taps$imm8[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor8b <- cor(taps$imm8[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor9b <- cor(taps$imm8[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor10b <- cor(taps$imm8[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor11b <- cor(taps$imm15[taps$all==1], taps$imm22[taps$all==1], method="spearman", use="pairwise")
tapscor12b <- cor(taps$imm15[taps$all==1], taps$imm27[taps$all==1], method="spearman", use="pairwise")
tapscor13b <- cor(taps$imm15[taps$all==1], taps$imm34[taps$all==1], method="spearman", use="pairwise")
tapscor14b <- cor(taps$imm15[taps$all==1], taps$imm37[taps$all==1], method="spearman", use="pairwise")
tapscor15b <- cor(taps$imm15[taps$all==1], taps$imm46[taps$all==1], method="spearman", use="pairwise")
tapscor16b <- cor(taps$imm15[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor17b <- cor(taps$imm15[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor18b <- cor(taps$imm15[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor19b <- cor(taps$imm15[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor20b <- cor(taps$imm22[taps$all==1], taps$imm27[taps$all==1], method="spearman", use="pairwise")
tapscor21b <- cor(taps$imm22[taps$all==1], taps$imm34[taps$all==1], method="spearman", use="pairwise")
tapscor22b <- cor(taps$imm22[taps$all==1], taps$imm37[taps$all==1], method="spearman", use="pairwise")
tapscor23b <- cor(taps$imm22[taps$all==1], taps$imm46[taps$all==1], method="spearman", use="pairwise")
tapscor24b <- cor(taps$imm22[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor25b <- cor(taps$imm22[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor26b <- cor(taps$imm22[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor27b <- cor(taps$imm22[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor28b <- cor(taps$imm27[taps$all==1], taps$imm34[taps$all==1], method="spearman", use="pairwise")
tapscor29b <- cor(taps$imm27[taps$all==1], taps$imm37[taps$all==1], method="spearman", use="pairwise")
tapscor30b <- cor(taps$imm27[taps$all==1], taps$imm46[taps$all==1], method="spearman", use="pairwise")
tapscor31b <- cor(taps$imm27[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor32b <- cor(taps$imm27[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor33b <- cor(taps$imm27[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor34b <- cor(taps$imm27[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor35b <- cor(taps$imm34[taps$all==1], taps$imm37[taps$all==1], method="spearman", use="pairwise")
tapscor36b <- cor(taps$imm34[taps$all==1], taps$imm46[taps$all==1], method="spearman", use="pairwise")
tapscor37b <- cor(taps$imm34[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor38b <- cor(taps$imm34[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor39b <- cor(taps$imm34[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor40b <- cor(taps$imm34[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor41b <- cor(taps$imm37[taps$all==1], taps$imm46[taps$all==1], method="spearman", use="pairwise")
tapscor42b <- cor(taps$imm37[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor43b <- cor(taps$imm37[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor44b <- cor(taps$imm37[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor45b <- cor(taps$imm37[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor46b <- cor(taps$imm46[taps$all==1], taps$imm49[taps$all==1], method="spearman", use="pairwise")
tapscor47b <- cor(taps$imm46[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor48b <- cor(taps$imm46[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor49b <- cor(taps$imm46[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor50b <- cor(taps$imm49[taps$all==1], taps$imm51[taps$all==1], method="spearman", use="pairwise")
tapscor51b <- cor(taps$imm49[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor52b <- cor(taps$imm49[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor53b <- cor(taps$imm51[taps$all==1], taps$imm54[taps$all==1], method="spearman", use="pairwise")
tapscor54b <- cor(taps$imm51[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")
tapscor55b <- cor(taps$imm54[taps$all==1], taps$imm56[taps$all==1], method="spearman", use="pairwise")

tapscor1diffa <- abs(tapscor1a - tapscor1b)
tapscor2diffa <- abs(tapscor2a - tapscor2b)
tapscor3diffa <- abs(tapscor3a - tapscor3b)
tapscor4diffa <- abs(tapscor4a - tapscor4b)
tapscor5diffa <- abs(tapscor5a - tapscor5b)
tapscor6diffa <- abs(tapscor6a - tapscor6b)
tapscor7diffa <- abs(tapscor7a - tapscor7b)
tapscor8diffa <- abs(tapscor8a - tapscor8b)
tapscor9diffa <- abs(tapscor9a - tapscor9b)
tapscor10diffa <- abs(tapscor10a - tapscor10b)
tapscor11diffa <- abs(tapscor11a - tapscor11b)
tapscor12diffa <- abs(tapscor12a - tapscor12b)
tapscor13diffa <- abs(tapscor13a - tapscor13b)
tapscor14diffa <- abs(tapscor14a - tapscor14b)
tapscor15diffa <- abs(tapscor15a - tapscor15b)
tapscor16diffa <- abs(tapscor16a - tapscor16b)
tapscor17diffa <- abs(tapscor17a - tapscor17b)
tapscor18diffa <- abs(tapscor18a - tapscor18b)
tapscor19diffa <- abs(tapscor19a - tapscor19b)
tapscor20diffa <- abs(tapscor20a - tapscor20b)
tapscor21diffa <- abs(tapscor21a - tapscor21b)
tapscor22diffa <- abs(tapscor22a - tapscor22b)
tapscor23diffa <- abs(tapscor23a - tapscor23b)
tapscor24diffa <- abs(tapscor24a - tapscor24b)
tapscor25diffa <- abs(tapscor25a - tapscor25b)
tapscor26diffa <- abs(tapscor26a - tapscor26b)
tapscor27diffa <- abs(tapscor27a - tapscor27b)
tapscor28diffa <- abs(tapscor28a - tapscor28b)
tapscor29diffa <- abs(tapscor29a - tapscor29b)
tapscor30diffa <- abs(tapscor30a - tapscor30b)
tapscor31diffa <- abs(tapscor31a - tapscor31b)
tapscor32diffa <- abs(tapscor32a - tapscor32b)
tapscor33diffa <- abs(tapscor33a - tapscor33b)
tapscor34diffa <- abs(tapscor34a - tapscor34b)
tapscor35diffa <- abs(tapscor35a - tapscor35b)
tapscor36diffa <- abs(tapscor36a - tapscor36b)
tapscor37diffa <- abs(tapscor37a - tapscor37b)
tapscor38diffa <- abs(tapscor38a - tapscor38b)
tapscor39diffa <- abs(tapscor39a - tapscor39b)
tapscor40diffa <- abs(tapscor40a - tapscor40b)
tapscor41diffa <- abs(tapscor41a - tapscor41b)
tapscor42diffa <- abs(tapscor42a - tapscor42b)
tapscor43diffa <- abs(tapscor43a - tapscor43b)
tapscor44diffa <- abs(tapscor44a - tapscor44b)
tapscor45diffa <- abs(tapscor45a - tapscor45b)
tapscor46diffa <- abs(tapscor46a - tapscor46b)
tapscor47diffa <- abs(tapscor47a - tapscor47b)
tapscor48diffa <- abs(tapscor48a - tapscor48b)
tapscor49diffa <- abs(tapscor49a - tapscor49b)
tapscor50diffa <- abs(tapscor50a - tapscor50b)
tapscor51diffa <- abs(tapscor51a - tapscor51b)
tapscor52diffa <- abs(tapscor52a - tapscor52b)
tapscor53diffa <- abs(tapscor53a - tapscor53b)
tapscor54diffa <- abs(tapscor54a - tapscor54b)
tapscor55diffa <- abs(tapscor55a - tapscor55b)

tapscor1diffb <- tapscor1a - tapscor1b
tapscor2diffb <- tapscor2a - tapscor2b
tapscor3diffb <- tapscor3a - tapscor3b
tapscor4diffb <- tapscor4a - tapscor4b
tapscor5diffb <- tapscor5a - tapscor5b
tapscor6diffb <- tapscor6a - tapscor6b
tapscor7diffb <- tapscor7a - tapscor7b
tapscor8diffb <- tapscor8a - tapscor8b
tapscor9diffb <- tapscor9a - tapscor9b
tapscor10diffb <- tapscor10a - tapscor10b
tapscor11diffb <- tapscor11a - tapscor11b
tapscor12diffb <- tapscor12a - tapscor12b
tapscor13diffb <- tapscor13a - tapscor13b
tapscor14diffb <- tapscor14a - tapscor14b
tapscor15diffb <- tapscor15a - tapscor15b
tapscor16diffb <- tapscor16a - tapscor16b
tapscor17diffb <- tapscor17a - tapscor17b
tapscor18diffb <- tapscor18a - tapscor18b
tapscor19diffb <- tapscor19a - tapscor19b
tapscor20diffb <- tapscor20a - tapscor20b
tapscor21diffb <- tapscor21a - tapscor21b
tapscor22diffb <- tapscor22a - tapscor22b
tapscor23diffb <- tapscor23a - tapscor23b
tapscor24diffb <- tapscor24a - tapscor24b
tapscor25diffb <- tapscor25a - tapscor25b
tapscor26diffb <- tapscor26a - tapscor26b
tapscor27diffb <- tapscor27a - tapscor27b
tapscor28diffb <- tapscor28a - tapscor28b
tapscor29diffb <- tapscor29a - tapscor29b
tapscor30diffb <- tapscor30a - tapscor30b
tapscor31diffb <- tapscor31a - tapscor31b
tapscor32diffb <- tapscor32a - tapscor32b
tapscor33diffb <- tapscor33a - tapscor33b
tapscor34diffb <- tapscor34a - tapscor34b
tapscor35diffb <- tapscor35a - tapscor35b
tapscor36diffb <- tapscor36a - tapscor36b
tapscor37diffb <- tapscor37a - tapscor37b
tapscor38diffb <- tapscor38a - tapscor38b
tapscor39diffb <- tapscor39a - tapscor39b
tapscor40diffb <- tapscor40a - tapscor40b
tapscor41diffb <- tapscor41a - tapscor41b
tapscor42diffb <- tapscor42a - tapscor42b
tapscor43diffb <- tapscor43a - tapscor43b
tapscor44diffb <- tapscor44a - tapscor44b
tapscor45diffb <- tapscor45a - tapscor45b
tapscor46diffb <- tapscor46a - tapscor46b
tapscor47diffb <- tapscor47a - tapscor47b
tapscor48diffb <- tapscor48a - tapscor48b
tapscor49diffb <- tapscor49a - tapscor49b
tapscor50diffb <- tapscor50a - tapscor50b
tapscor51diffb <- tapscor51a - tapscor51b
tapscor52diffb <- tapscor52a - tapscor52b
tapscor53diffb <- tapscor53a - tapscor53b
tapscor54diffb <- tapscor54a - tapscor54b
tapscor55diffb <- tapscor55a - tapscor55b

tapscordiff1 <- c(tapscor1diffa, tapscor2diffa, tapscor3diffa, tapscor4diffa, tapscor5diffa, tapscor6diffa, tapscor7diffa, tapscor8diffa, tapscor9diffa, tapscor10diffa, tapscor11diffa, tapscor12diffa, tapscor13diffa, tapscor14diffa, tapscor15diffa, tapscor16diffa, tapscor17diffa, tapscor18diffa, tapscor19diffa, tapscor20diffa, tapscor21diffa, tapscor22diffa, tapscor23diffa, tapscor24diffa, tapscor25diffa, tapscor26diffa, tapscor27diffa, tapscor28diffa, tapscor29diffa, tapscor30diffa, tapscor31diffa, tapscor32diffa, tapscor33diffa, tapscor34diffa, tapscor35diffa, tapscor36diffa, tapscor37diffa, tapscor38diffa, tapscor39diffa, tapscor40diffa, tapscor41diffa, tapscor42diffa, tapscor43diffa, tapscor44diffa, tapscor45diffa, tapscor46diffa, tapscor47diffa, tapscor48diffa, tapscor49diffa, tapscor50diffa, tapscor51diffa, tapscor52diffa, tapscor53diffa, tapscor54diffa, tapscor55diffa)

tapscordiff2 <- c(tapscor1diffb, tapscor2diffb, tapscor3diffb, tapscor4diffb, tapscor5diffb, tapscor6diffb, tapscor7diffb, tapscor8diffb, tapscor9diffb, tapscor10diffb, tapscor11diffb, tapscor12diffb, tapscor13diffb, tapscor14diffb, tapscor15diffb, tapscor16diffb, tapscor17diffb, tapscor18diffb, tapscor19diffb, tapscor20diffb, tapscor21diffb, tapscor22diffb, tapscor23diffb, tapscor24diffb, tapscor25diffb, tapscor26diffb, tapscor27diffb, tapscor28diffb, tapscor29diffb, tapscor30diffb, tapscor31diffb, tapscor32diffb, tapscor33diffb, tapscor34diffb, tapscor35diffb, tapscor36diffb, tapscor37diffb, tapscor38diffb, tapscor39diffb, tapscor40diffb, tapscor41diffb, tapscor42diffb, tapscor43diffb, tapscor44diffb, tapscor45diffb, tapscor46diffb, tapscor47diffb, tapscor48diffb, tapscor49diffb, tapscor50diffb, tapscor51diffb, tapscor52diffb, tapscor53diffb, tapscor54diffb, tapscor55diffb)

tapscordiffa1 <- sum(tapscordiff1)/55
tapscordiffb1 <- sum(tapscordiff2)/55
tapscor_max <- max(tapscordiff1)

tapscora1 <- c(tapscor1a, tapscor2a, tapscor3a, tapscor4a, tapscor5a, tapscor6a, tapscor7a, tapscor8a, tapscor9a, tapscor10a, tapscor11a, tapscor12a, tapscor13a, tapscor14a, tapscor15a, tapscor16a, tapscor17a, tapscor18a, tapscor19a, tapscor20a, tapscor21a, tapscor22a, tapscor23a, tapscor24a, tapscor25a, tapscor26a, tapscor27a, tapscor28a, tapscor29a, tapscor30a, tapscor31a, tapscor32a, tapscor33a, tapscor34a, tapscor35a, tapscor36a, tapscor37a, tapscor38a, tapscor39a, tapscor40a, tapscor41a, tapscor42a, tapscor43a, tapscor44a, tapscor45a, tapscor46a, tapscor47a, tapscor48a, tapscor49a, tapscor50a, tapscor51a, tapscor52a, tapscor53a, tapscor54a, tapscor55a)

tapscorb1 <- c(tapscor1b, tapscor2b, tapscor3b, tapscor4b, tapscor5b, tapscor6b, tapscor7b, tapscor8b, tapscor9b, tapscor10b, tapscor11b, tapscor12b, tapscor13b, tapscor14b, tapscor15b, tapscor16b, tapscor17b, tapscor18b, tapscor19b, tapscor20b, tapscor21b, tapscor22b, tapscor23b, tapscor24b, tapscor25b, tapscor26b, tapscor27b, tapscor28b, tapscor29b, tapscor30b, tapscor31b, tapscor32b, tapscor33b, tapscor34b, tapscor35b, tapscor36b, tapscor37b, tapscor38b, tapscor39b, tapscor40b, tapscor41b, tapscor42b, tapscor43b, tapscor44b, tapscor45b, tapscor46b, tapscor47b, tapscor48b, tapscor49b, tapscor50b, tapscor51b, tapscor52b, tapscor53b, tapscor54b, tapscor55b)

tapscoria <- (tapscordiffa1)
tapscorib <- (tapscordiffb1)


#################
####VSG Panel####
#################

vsgcor1a <- cor(vsg$immigration_11[vsg$all==0], vsg$immigration_16[vsg$all==0], method="spearman", use="pairwise")
vsgcor2a <- cor(vsg$immigration_11[vsg$all==0], vsg$immigration_18[vsg$all==0], method="spearman", use="pairwise")
vsgcor3a <- cor(vsg$immigration_16[vsg$all==0], vsg$immigration_18[vsg$all==0], method="spearman", use="pairwise")

vsgcor1b <- cor(vsg$immigration_11[vsg$all==1], vsg$immigration_16[vsg$all==1], method="spearman", use="pairwise")
vsgcor2b <- cor(vsg$immigration_11[vsg$all==1], vsg$immigration_18[vsg$all==1], method="spearman", use="pairwise")
vsgcor3b <- cor(vsg$immigration_16[vsg$all==1], vsg$immigration_18[vsg$all==1], method="spearman", use="pairwise")

vsgcor1diffa <- abs(vsgcor1a - vsgcor1b)
vsgcor2diffa <- abs(vsgcor2a - vsgcor2b)
vsgcor3diffa <- abs(vsgcor3a - vsgcor3b)

vsgcor1diffb <- vsgcor1a - vsgcor1b
vsgcor2diffb <- vsgcor2a - vsgcor2b
vsgcor3diffb <- vsgcor3a - vsgcor3b

vsgcordiff1 <- c(vsgcor1diffa, vsgcor2diffa, vsgcor3diffa)
vsgcordiff2 <- c(vsgcor1diffb, vsgcor2diffb, vsgcor3diffb)
vsgcordiffa <- sum(vsgcordiff1)/3
vsgcordiffb <- sum(vsgcordiff2)/3
vsgcor_max <- max(vsgcordiff1)

vsgcora <- c(vsgcor1a, vsgcor2a, vsgcor3a)
vsgcorb <- c(vsgcor1b, vsgcor2b, vsgcor3b)
vsgcor <- cbind(vsgcora, vsgcorb)

##Question 1
vsgcor1a <- cor(vsg$imm1_11[vsg$all==0], vsg$imm1_16[vsg$all==0], method="spearman", use="pairwise")
vsgcor2a <- cor(vsg$imm1_11[vsg$all==0], vsg$imm1_18[vsg$all==0], method="spearman", use="pairwise")
vsgcor3a <- cor(vsg$imm1_16[vsg$all==0], vsg$imm1_18[vsg$all==0], method="spearman", use="pairwise")

vsgcor1b <- cor(vsg$imm1_11[vsg$all==1], vsg$imm1_16[vsg$all==1], method="spearman", use="pairwise")
vsgcor2b <- cor(vsg$imm1_11[vsg$all==1], vsg$imm1_18[vsg$all==1], method="spearman", use="pairwise")
vsgcor3b <- cor(vsg$imm1_16[vsg$all==1], vsg$imm1_18[vsg$all==1], method="spearman", use="pairwise")

vsgcor1diffa <- abs(vsgcor1a - vsgcor1b)
vsgcor2diffa <- abs(vsgcor2a - vsgcor2b)
vsgcor3diffa <- abs(vsgcor3a - vsgcor3b)

vsgcor1diffb <- vsgcor1a - vsgcor1b
vsgcor2diffb <- vsgcor2a - vsgcor2b
vsgcor3diffb <- vsgcor3a - vsgcor3b

vsgcordiff1 <- c(vsgcor1diffa, vsgcor2diffa, vsgcor3diffa)
vsgcordiff2 <- c(vsgcor1diffb, vsgcor2diffb, vsgcor3diffb)
vsgcordiffa1 <- sum(vsgcordiff1)/3
vsgcordiffb1 <- sum(vsgcordiff2)/3
vsgcor_max1 <- max(vsgcordiff1)

vsgcora1 <- c(vsgcor1a, vsgcor2a, vsgcor3a)
vsgcorb1 <- c(vsgcor1b, vsgcor2b, vsgcor3b)
vsgcor1 <- cbind(vsgcora1, vsgcorb1)

##Question 2
vsgcor1a <- cor(vsg$imm2_11[vsg$all==0], vsg$imm2_16[vsg$all==0], method="spearman", use="pairwise")
vsgcor2a <- cor(vsg$imm2_11[vsg$all==0], vsg$imm2_18[vsg$all==0], method="spearman", use="pairwise")
vsgcor3a <- cor(vsg$imm2_16[vsg$all==0], vsg$imm2_18[vsg$all==0], method="spearman", use="pairwise")

vsgcor1b <- cor(vsg$imm2_11[vsg$all==1], vsg$imm2_16[vsg$all==1], method="spearman", use="pairwise")
vsgcor2b <- cor(vsg$imm2_11[vsg$all==1], vsg$imm2_18[vsg$all==1], method="spearman", use="pairwise")
vsgcor3b <- cor(vsg$imm2_16[vsg$all==1], vsg$imm2_18[vsg$all==1], method="spearman", use="pairwise")

vsgcor1diffa <- abs(vsgcor1a - vsgcor1b)
vsgcor2diffa <- abs(vsgcor2a - vsgcor2b)
vsgcor3diffa <- abs(vsgcor3a - vsgcor3b)

vsgcor1diffb <- vsgcor1a - vsgcor1b
vsgcor2diffb <- vsgcor2a - vsgcor2b
vsgcor3diffb <- vsgcor3a - vsgcor3b

vsgcordiff1 <- c(vsgcor1diffa, vsgcor2diffa, vsgcor3diffa)
vsgcordiff2 <- c(vsgcor1diffb, vsgcor2diffb, vsgcor3diffb)
vsgcordiffa2 <- sum(vsgcordiff1)/3
vsgcordiffb2 <- sum(vsgcordiff2)/3
vsgcor_max2 <- max(vsgcordiff1)

vsgcora2 <- c(vsgcor1a, vsgcor2a, vsgcor3a)
vsgcorb2 <- c(vsgcor1b, vsgcor2b, vsgcor3b)
vsgcor2 <- cbind(vsgcora, vsgcorb)

##Question 3
vsgcor1a <- cor(vsg$imm3_11[vsg$all==0], vsg$imm3_16[vsg$all==0], method="spearman", use="pairwise")
vsgcor2a <- cor(vsg$imm3_11[vsg$all==0], vsg$imm3_18[vsg$all==0], method="spearman", use="pairwise")
vsgcor3a <- cor(vsg$imm3_16[vsg$all==0], vsg$imm3_18[vsg$all==0], method="spearman", use="pairwise")

vsgcor1b <- cor(vsg$imm3_11[vsg$all==1], vsg$imm3_16[vsg$all==1], method="spearman", use="pairwise")
vsgcor2b <- cor(vsg$imm3_11[vsg$all==1], vsg$imm3_18[vsg$all==1], method="spearman", use="pairwise")
vsgcor3b <- cor(vsg$imm3_16[vsg$all==1], vsg$imm3_18[vsg$all==1], method="spearman", use="pairwise")

vsgcor1diffa <- abs(vsgcor1a - vsgcor1b)
vsgcor2diffa <- abs(vsgcor2a - vsgcor2b)
vsgcor3diffa <- abs(vsgcor3a - vsgcor3b)

vsgcor1diffb <- vsgcor1a - vsgcor1b
vsgcor2diffb <- vsgcor2a - vsgcor2b
vsgcor3diffb <- vsgcor3a - vsgcor3b

vsgcordiff1 <- c(vsgcor1diffa, vsgcor2diffa, vsgcor3diffa)
vsgcordiff2 <- c(vsgcor1diffb, vsgcor2diffb, vsgcor3diffb)
vsgcordiffa3 <- sum(vsgcordiff1)/3
vsgcordiffb3 <- sum(vsgcordiff2)/3
vsgcor_max3 <- max(vsgcordiff1)

vsgcora3 <- c(vsgcor1a, vsgcor2a, vsgcor3a)
vsgcorb3 <- c(vsgcor1b, vsgcor2b, vsgcor3b)
vsgcor3 <- cbind(vsgcora, vsgcorb)

vsgcoria <- (vsgcordiffa1 + vsgcordiffa2 + vsgcordiffa3)/3
vsgcorib <- (vsgcordiffb1 + vsgcordiffb2 + vsgcordiffb3)/3
vsgcor_max <- c(vsgcor_max1, vsgcor_max2, vsgcor_max3)
vsgcor_max <- max(vsgcor_max)

#############
####Table#### 
#############

column1 <- c("LISS", "BES", "NCP", "INES", "SHP", "GLES", "TAPS", "VSG")
column2 <- c(lisscoria, bescoria, ncpcoria, inescoria, shpcoria, glescoria, tapscoria, vsgcoria)
column3 <- c(lisscorib, bescorib, ncpcorib, inescorib, shpcorib, glescorib, tapscorib, vsgcorib)
column4 <- c(lisscor_max, bescor_max, ncpcor_max, inescor_max, shpcor_max, glescor_max, tapscor_max, vsgcor_max)
column5 <- c(216, 84, 30, 10, 66, 45, 55, 9)

table <- data.frame(column1, column2, column3, column4, column5)
colnames(table) <- c("Panel Study", "Average Absolute Difference", "Average Signed Difference", "Largest Difference", "Number of Correlations")
table <- xtable(table, type = "latex", latex.environments = "center", caption = "")
align(table) <- "llcccc"
digits(table)[c(6)] <- 0
print(table, include.rownames=FALSE, include.colnames=FALSE, sanitize.text.function=identity, only.contents=TRUE, hline.after = NULL, file="/Users/dillonlaaker/Box Sync/Stability/Draft/tables/tableA5.tex")

